My code is with mysqli_* and I want to make it with prepared statements. I’ve read some tutorials but is a little bit hard for newbie to understant what and how. So I started and this is so far what I have… just the beginning. So from here to down can someone help me?
if(isset($_GET['oke_id'])){
$joke_id = $_GET['oke_id'];
$qry = $con->prepare("SELECT * FROM oke WHERE oke_cat = ?");
$qry->bind_param('i', $oke_id);
$qry->execute();
$result = $qry->get_result();
$result->fetch_array();
$result = mysqli_query($con, $qry) or die("Query failed: " . mysqli_errno($con));*/
$line = mysqli_fetch_array($result, MYSQL_BOTH);
if (!$line) echo '';
$previd = -1;
$currid = $line[0];
if (isset($_GET['id'])) {
$previous_ids = array();
do {
$previous_ids[] = $line[0];
$currid = $line[0];
if ($currid == $_GET['id']) break;
$previd = end($previous_ids);
$line = mysqli_fetch_array($result, MYSQL_BOTH);
} while ($line);
}
if ($line) {
echo "<div id=\\"box\\">";
echo nl2br($line['text']) . "<br /><br />";
echo "<div id=\\"share\\"><span class='st_facebook' displayText='Facebook'></span>
<span class='st_twitter' displayText='Tweet'></span>
<span class='st_googleplus' displayText='Google +'></span></div>";
echo '<br /><br /><br />';
echo "</div>";
}
else echo '<p>Empty category</p><br/>';
I have trouble from $result->fetch_array(); to down. Now they are mixed and don’t realy know what to do?