Jump to content

Recommended Posts

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">&nbsp;<? 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" />&nbsp;&nbsp;</td>

  </tr>
</table>
<?php
}
?>
<?php
mysqli_close($con);
?>

 

Link to comment
https://forums.phpfreaks.com/topic/310409-convert-to-mysqli/
Share on other sites

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  <?=

Link to comment
https://forums.phpfreaks.com/topic/310409-convert-to-mysqli/#findComment-1575993
Share on other sites

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">&nbsp;</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>&nbsp;</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">&nbsp;</td>

<td width="1%">&nbsp;</td>
</tr>
</table>
</td>
</form>
</tr>
</table>
</body>
<?php
// close connection
mysqli_close($con);
?>

 

Link to comment
https://forums.phpfreaks.com/topic/310409-convert-to-mysqli/#findComment-1576028
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.