winmastergames Posted April 9, 2008 Share Posted April 9, 2008 Ok well im making a script and is there any way that if MYSQL has a error it redirects to another Page (Error Page) Heres a piece of MYSQL code: <?php $sql = "SELECT * FROM $userget"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { echo "".$row['title'].""; } ?> I just need a sample on how to do this so i can add it myself Thanks Alot Link to comment https://forums.phpfreaks.com/topic/100397-php-mysql-getting-data-error-page/ Share on other sites More sharing options...
matto Posted April 9, 2008 Share Posted April 9, 2008 $query = mysql_query($sql) or die(mysql_error()); or $query = mysql_query($sql) or header("Location: error.php"); Link to comment https://forums.phpfreaks.com/topic/100397-php-mysql-getting-data-error-page/#findComment-513427 Share on other sites More sharing options...
winmastergames Posted April 9, 2008 Author Share Posted April 9, 2008 Doesnt Seem To Work? It still displays the error ? Link to comment https://forums.phpfreaks.com/topic/100397-php-mysql-getting-data-error-page/#findComment-513442 Share on other sites More sharing options...
matto Posted April 10, 2008 Share Posted April 10, 2008 you may need to suppress the normal error from the mysql_query function using @mysql_query($sql) $query = @mysql_query($sql) or header("Location: error.php"); Link to comment https://forums.phpfreaks.com/topic/100397-php-mysql-getting-data-error-page/#findComment-514181 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.