0

Hai,

In one of my project I need to add some data into my data base and redirect the page to a different page.

In this case I need to check whether the data has uploaded successfully and then redirect. For a rough sample

mysql_query("INSERT INTO")

if(data added ){
redirect to a page
}
else
Show Error page

I know MySQL query. But please help me with right code

Thanks in advance
Rajeesh

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by emhmk1
0

Hai,

In one of my project I need to add some data into my data base and redirect the page to a different page.

In this case I need to check whether the data has uploaded successfully and then redirect. For a rough sample

mysql_query("INSERT INTO")

if(data added ){
redirect to a page
}
else
Show Error page

I know MySQL query. But please help me with right code

Thanks in advance
Rajeesh

Hi, A very simple method would be this

$Query = mysql_query("INSERT INTO `table` (name,age) VALUES ('$name','$age')");
	if (!$Query){
		echo "ERROR: " .mysql_error();
	}
		
		else{ echo " Added to Database";}

Hope it helps..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.