Birdmansplace Posted March 28, 2020 Share Posted March 28, 2020 I wrote a website years ago and when i finally upgraded the system its was running on all my mysql commands are depreciated. So i started working on the small files to fix all the errors and now that i no longer have errors the code seams to not fetch the data from the db. its been years since i coded and now i have to re educate my self. Any help would be nice, thanks <?php ini_set("display_errors", "1"); error_reporting(E_ALL); include("dbinfo.php"); $con = mysqli_connect($host,$username,$password); // Connect to server and select database. mysqli_select_db($con, "databasename")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name3 ORDER BY date DESC LIMIT 3"; $result=mysqli_query($con, $sql); ?> <br /> <?php while($rows=mysqli_fetch_array($result)){ ?> <table width="85%"> <tr> <td width="50%" align="left"><p><a href="events/viewevent3.php?sid=<? echo $rows['sid']; ?>" class="link"> <? echo $rows['stitle']; ?></a></p> <p class="clr-1"><? echo $rows['datepicker']; ?></p> <p class="p3">Click event name for more Details!</p></td> <td width="50%" align="right"><img src="<? echo $rows['pic']; ?>" width="171" height="137" /> </td> </tr> </table> <?php } ?> <?php mysqli_close($con); ?> Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted March 28, 2020 Share Posted March 28, 2020 8 minutes ago, Birdmansplace said: the code seams to not fetch the data from the db what result or symptom are you getting that leads you to believe that? btw - the short opening php tags <? my not be enabled on your server. you should ALWAYS use full opening <?php tags. You can also use a combined opening/echo tag <?= Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted March 28, 2020 Author Share Posted March 28, 2020 because none of the information is loading on the page that is stored in the db Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted March 28, 2020 Author Share Posted March 28, 2020 see what you mean by the echo tag.. its fetching data now. Quote Link to comment Share on other sites More sharing options...
Birdmansplace Posted March 29, 2020 Author Share Posted March 29, 2020 most of my site is now switched to mysqli but i am having issues with a page. its not giving me any errors and its fetching the info from the db. i have an edit function per entree that loads this page. when i click on it the edit and the page loads there is no info from db to edit and when i submit nothing changes. some one mind taking a look, thanks. <? ini_set("display_errors", "10"); error_reporting(E_ALL); include("../dbinfo.php"); $con = mysqli_connect($host,$username,$password); mysqli_select_db($con, "database") or die( "Unable to select database"); // get value of id that sent from address bar $sid=$_GET['sid']; // Retrieve data from database $sql="SELECT * FROM simple_search WHERE sid='$sid'"; $result=mysqli_query($con, $sql); $rows=mysqli_fetch_array($result); ?> <body bgcolor="#666666"> <br /> <table width="95%" border="0" cellspacing="1" cellpadding="0" align="center"> <tr> <form name="form1" method="post" action="crew_update_ac.php"> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0" align="center"> <tr> <td height="64"> </td> <td colspan="3" align="center"><strong>Update Upcoming Event</strong> </td> </tr> <tr> <td align="center" width="9%"><strong>Event Name</strong></td> <td width="85%"><input name="stitle" type="text" id="stitle" value="<?php echo $rows['stitle']; ?>" size="50"></td> </tr> <tr> <td width="9%" height="54" align="center"><strong>Event Date</strong></td> <td width="85%"><input name="datepicker" type="text" id="datepicker" value="<?php echo $rows['datepicker']; ?>" size="50"></td> </tr> <tr> <td align="center" width="9%"><strong>Event Info</strong></td> <td width="85%"><textarea name="sbody" id="sbody" cols="150" rows="50"><?php echo $rows['sbody']; ?></textarea></td> </tr> <tr> <td align="center" width="9%"><strong>Picture</strong></td> <td width="85%"><input name="pic" id="pic" size="50" value="<?php echo $rows['pic']; ?>"></td> <td>Current Picture <br><img src="<?php echo $rows['pic']; ?>" width="173" height="137"/></td> </tr> <tr> <td align="center" width="9%"><strong>Flyer</strong></td> <td width="85%"><input name="file" id="file" size="50" value="<?php echo $rows['file']; ?>"></td> <td></td> </tr> <tr> <td> </td> <td align="center"><input name="id" type="hidden" id="id" value="<?php echo $rows['sid']; ?>"> <input type="submit" name="Submit" value="Submit" /></td> <td width="5%" align="center"> </td> <td width="1%"> </td> </tr> </table> </td> </form> </tr> </table> </body> <?php // close connection mysqli_close($con); ?> Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted March 29, 2020 Share Posted March 29, 2020 its probably the short opening php tag on line 1 in the posted code. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.