|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
SQL Php web page Issue.
Hi,
I have a problem with some pages of an Internet site not working properly. The pages all access the SQL /PHP database using a php ID call. From the PHP admin page all the data seems to be there but the result web page says there are no database entries. Just to see if any data has been lost I have tried using backed up SQL data but this also gives the same problem. The php code has not changed for the pages either. Any ideas of what might cause this? Thanks in advance. Ronan. |
|
#2
|
||||
|
||||
|
RE: SQL Php web page Issue.
Posting your code might help us....
|
|
#3
|
|||
|
|||
|
RE: SQL Php web page Issue.
Hi,
Here's the code, It has'nt changed. It's not until this code calls eventsmore.php3 the problem shows up which I cant undersatnd. It seems to retrive some data but not the eventsmore.php request.... events.php3.... <table cellspacing=1 cellpadding=2 border=0 width=600 valign=top background=bgplain.gif> <tr> <td bgcolor=#aedaff valign=top colspan=2> <center> <font color=003366 face=arial size=2><B>Latest News</B></font> </center> </TD></TR> <?php require("db.php3"); ?> <? $result = mysql_query("SELECT * FROM events"); $numrows = mysql_num_rows($result); if($numrows == 0) { echo("There are no events in database."); } while($row = mysql_fetch_array($result)) { echo(" <tr> <td align=left valign=top> <font face=arial size=2 color=#aedaff><B> $row[headline]</B> </td></tr> <tr> <td align=left valign=top width=25%> <font face=arial size=2 color=ffffff> <I><B>$row[brief]</B></I> </td></tr> <tr> <td align=left valign=bottom> <a href="eventsmore.php3?id=$row[id]"><font face=arial size=1 color=orange><img src=images/bullet.gif border=0 > Read Article </a> </font></td></tr> <tr><td colspan=2> </td></tr> "); } ?> </table> eventsmore.php3.... <?php require("header2.php3"); ?> <table cellspacing=1 cellpadding=3 background=bgplain.gif border=0 width=600 valign=top width=400 > <tr> <td bgcolor=#aedaff width=100% align=top colspan=2> <center> <font color=003366 face=arial size=2><B>Latest News</B></font> </center> </TD></TR> <?php require("db.php3"); ?> <? $result = mysql_query("select * from events where id = '$id'"); $numrows = mysql_num_rows($result); if($numrows == 0) { echo("There are no news in database."); } while($row = mysql_fetch_array($result)) { echo(" <tr> <td align=left valign=top width=600 > <font face=arial size=2 color=#aedaff> <B> $row[headline] </B> </td></tr> <tr> <td align=left valign=top width=600 > <font face=arial size=2 color=ffffff> <I><B> $row[brief] </I></B> </td></tr> <tr> <td align=left valign=top width=600 > <font face=arial size=2 color=ffffff> $row[complete] </td></tr> <tr><td colspan=2> </td></tr> "); } ?> </table> <?php require("footer2.php3"); ?> |
|
#4
|
||||
|
||||
|
RE: SQL Php web page Issue.
Try this:
In eventsmore.php3: Before this line add: $id= $_GET['id']; In case this doesnt help, tell us about the errors you get... |
|
#5
|
|||
|
|||
|
RE: SQL Php web page Issue.
Hey,
Thanks for you reply, yeap that seems to work for the busted pages, there's only one problem left on a search page which again puts query to the database... I tried to interpret your great fix to no result can you advise once again? Thanks again for your great help in advance... Here's the code.. <?php require("header2.php3"); ?> <table cellspacing=1 cellpadding=2 border=0 width=600 valign=top background=bgplain.gif> <tr><td colspan=2 bgcolor=#aedaff align=center valign=middle><font size=2 color=#003366><B> Search Results</B> </td></tr> <?php require("db.php3"); ?> <? $result = mysql_query("select * FROM abstracts where titleab like '%$searchname%' or authors like '%$searchname%' or journal like '%$searchname%' or abstract like '%$searchname%'"); $numrows = mysql_num_rows($result); if($numrows == 0) { echo("<table width=600 background=bgplain.gif><tr><td align=center><br><b>There are no Abstracts in the database matching your search criteria please refine your search. <a href=abstracts.html><font color=orange>Go Back</a></b></td></tr></table>"); } while($row = mysql_fetch_array($result)) { echo(" <tr> <td align=right valign=top width=25%> <font face=arial size=1 color=orange> <B>Title: </B> </td> <td align=left valign=top> <font face=arial size=1 color=ffffff> <B>$row[titleab]</B> </td></tr> <tr> <td align=right valign=top width=25%> <font face=arial size=1 color=orange> <B>Authors: </B> </td> <td align=left valign=top> <font face=arial size=1 color=ffffff> $row[authors] </td></tr> <tr> <td align=right valign=top width=25%> <font face=arial size=1 color=orange> <B>Journal/Conference: </B> </td> <td align=left valign=top> <font face=arial size=1 color=ffffff> $row[journal] </td></tr> <tr> <td align=right valign=top width=25%> <font face=arial size=1 color=orange> <B>Date: </B> </td> <td align=left valign=top> <font face=arial size=1 color=ffffff> $row[date] </td></tr> <tr> <td align=right valign=top> </td> <td align=left valign=bottom> <a href="abstractsmore.php3?id=$row[id]"><font face=arial size=1 color=orange><img src=images/bullet.gif border=0 > Complete Abstract </a> </font></td></tr> <tr><td colspan=2 align=right> <a href=abstracts.html><font color=#aedaff><img src=images/bulletback.gif border=0> <B>Go Back</a></b><P></td></tr> "); } ?> </table> <?php require("footer2.php3"); ?> |
|
#6
|
||||
|
||||
|
RE: SQL Php web page Issue.
I assume that $searchname comes from a form, right? The try putting
$searchname=$_GET['searchname']; or $searchname=$_POST['searchname']; before you query. Use $_GET if your form uses get method and $_POST if it uses POST method. |
|
#7
|
|||
|
|||
|
RE: SQL Php web page Issue.
Hi,
I have tried adding the $serachname=$_post , but still is'nt working. I still dont understand what has happened to the site. Everything worked without the additions before. I have a page that allows edits of the site, and additions to the database. This also is not working, again why I dont understand. anyway thanks for your time and efforts ! I'll have a good look again and see if I can be specific on what is causing my problem. Ronan. |
|
#8
|
||||
|
||||
|
RE: SQL Php web page Issue.
how about $searchname = $_GET['searchname'];
If it worked before w/out these but now requires these, then something of someone has turned register_globals OFF in php.ini file. |
|
#9
|
|||
|
|||
|
RE: SQL Php web page Issue.
Hi,
Where would I find this php.ini file and how can I reset this " register_globals" back to on ? Thanks in advance... r. |
|
#10
|
|||
|
|||
|
RE: SQL Php web page Issue.
I have found this php.ini file in winnt and it is turned on.....
r. |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > SQL Php web page Issue. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|