3
Contributors
9
Replies
10
Views
5 Years
Discussion Span
Last Post by mariaceline_21
0

Can't really help you without seeing what the code before, on and after line 8 looks like.

Without seeing code I'm assuming your passing something like the return of explode() directly into another function. e.g. $foo = array_shift( explode( '.', $bar ) );

0

<?php

define('INCLUDE_CHECK',1);
require "../connect.php";

if(!$_POST['img']) die("There is no such product!");

$img=mysql_real_escape_string(end(explode('/',$_POST['img'])));

$row=mysql_fetch_assoc(mysql_query("SELECT * FROM internet_shop WHERE img='".$img."'"));

if(!$row) die("There is no such product!");

echo '<strong>'.$row['name'].'</strong>

<p class="descr">'.$row['description'].'</p>

<strong>price: $'.$row['price'].'</strong>
<small>Drag it to your shopping cart to purchase it</small>';
?>

0

Strict Standards: Only variables should be passed by reference

Try changing code at line number 8:

$imagename = end(explode('/',$_POST['img']));
$img = mysql_real_escape_string($imagename);
0

vibhaj:

$imagename = end(explode('/',$_POST['img']));
$img = mysql_real_escape_string($imagename);

still the same error :(

0
$imagename = end(explode('/',$_POST['img']));
$img = mysql_real_escape_string($imagename);

Does not resolve the pass by reference issue given the ops original code.

$parts = explode('/',$_POST['img'])
$imagename = end( $parts );
$img = mysql_real_escape_string($imagename);

Should resolve the issue as the return of explode is not passed directly into another function call.

0

$parts = explode('/',$_POST['img'])
$imagename = end( $parts );
$img = mysql_real_escape_string($imagename);

thank you so much :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.