View Single Post
Old 12-12-2012, 05:20 PM   PM User | #4
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,493
Thanks: 44
Thanked 438 Times in 427 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Quote:
Originally Posted by Brian.Wynes View Post
Warning: Wrong parameter count for mysql_query() in /home/harold/public_html/news/index.php on line 147

PHP Code:
$sql mysql_query("SELECT `title`,`content`,`date` FROM `news` WHERE `id` = ?", array($_GET['id']), true); 
You can't do that! Look at the php function manual for mysql_query:

Quote:
resource mysql_query ( string $query [, resource $link_identifier = NULL ] )
You're using 3 parameters yet the function can only take two - the second being a link identifier (the resource returned from mysql_connect) which is optional. You're passing it the $_GET array instead. The function returns a resource.

The function manual on php.net is very important and will save you a lot of hassle if you learn to use it and understand what it is telling you. You can't just make up your own parameters to a function or assume its the same as another with the same name from a different language or database - you need to target the manual and actually find out how to use it accurately.

You can lookup any function by visiting this link: http://www.php.net/<function_name>
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote