homepage Welcome to WebmasterWorld Guest from 54.226.80.196
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Need a bit of help with Script error
Simple "script execution error"
Senmar50




msg:1251798
 11:28 pm on Nov 22, 2005 (gmt 0)

Hi All,

I placed the code in WebCoder and still couldn't find the error. I know it will be easy for you alll to see.
I just get a bit frustrated from these kinds of "simplistic" errors.

Thanks,
Senmar

<?
include(?.php');

// Get some data from the table.
$query = "SELECT publication_name, publication_year, url FROM news_table WHERE publication_name='$publication_name', publication_year='$publication_year', url='$url'";

$result =@mysql_query($query) or die ('Could not execute query.');

echo "<table border=1>";
echo "<tr><th>Publication Name</th><th>Publication Year</th><th>Volume Number</th><th>URL</th></tr>";

while($row = mysql_fetch_array($result))
{

// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['publication_name'];
echo "</td><td>";
echo $row['publication_year'];
echo "</td><td>";
echo $row['volume_number'];
echo "</td><td>";
echo $row['url'];
echo "</td></tr>";

echo "</table>";
}
?>
<html>
<form method="post" name="Publications" action="srch.php">
<table><tr>
<td>Publication Name:</td>
<td><input type="text" name="publication_name" size="40" maxlength="45"></td>
</tr><tr>
<td>Publication Year:</td>
<td><input type="text" name="publication_year" size="4" maxlength="4"></td>
</tr><tr>
<td>Volume Number:</td>
<td><input type="text" name="volume_number size="4" maxlength="5"></td>
</tr><tr>
<td>URL:</td>
<td><input type="text" name="url" size="60" maxlength="65"></td>
</tr>
<tr><td colspan="2" align="center">
<input type="submit" name="Publications" value="Search Database">
<input type="reset" name="reset" value="Reset"></td>
</tr></table>
</form>
</html>

 

Timotheos




msg:1251799
 12:02 am on Nov 23, 2005 (gmt 0)

Well the include statement looks weird
include(?.php');

If that's not it then what is the error message and what line is it on?

Tim

Senmar50




msg:1251800
 3:00 am on Nov 23, 2005 (gmt 0)

Hi!

I just removed the real information from the "include" statement. It contains the connect information. The error I am getting is "Can't execute query" It follows my SELECT statment.

Thanks
SenMar

Timotheos




msg:1251801
 3:14 am on Nov 23, 2005 (gmt 0)

Ok, well let's do a little debugging. Make these changes to view your sql statement and get some feedback on the error.

$query = "SELECT publication_name, publication_year, url FROM news_table WHERE publication_name='$publication_name', publication_year='$publication_year', url='$url'";

echo $query."<br>";

$result =@mysql_query($query) or die (mysql_errno().": ".mysql_error()."<br>");

It's probably something like a ' in one of your variables that's making it choke.

Tim

dreamcatcher




msg:1251802
 8:39 am on Nov 23, 2005 (gmt 0)

I`m guessing the problem is the commas in your query. Try:

$query = "SELECT publication_name, publication_year, url FROM news_table WHERE publication_name='$publication_name' AND publication_year='$publication_year' AND url='$url'";

dc

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved