-
problem with variable in php
i have big problem with variable it seem to not work properly. sad.
please help me.
My code:
PHP Code:
for($m=0;$m<count($arrayProd);$m++)
{
//get image of product
$product_name1=substr(trim($arrayProd[$m]),0,strpos($arrayProd[$m],"(")-1);
echo $product_name1."<br>";
while($row2=mysql_fetch_array($rs2))
{
if(strcmp($row2['fullname'],$product_name1) == 0)
{ echo "sp='".$product_name1."'<br>";
$stack_products=$stack_products."<td><img src='".$row2['image']."' border='0'/><br><a target='_blank' href='http://sakurakhanh.summerhost.info/downloadpage.php?media=".$row2['name']."'>".$row2['fullname']."</a></td>";
}
}
}
==> the line echo "sp='".$product_name1."'<br>"; get value of $product_name1 that empty. why???
-
Well, you set that variable a few lines earlier via:
PHP Code:
$product_name1=substr(trim($arrayProd[$m]),0,strpos($arrayProd[$m],"(")-1);
You need to debug all the variables involved (echo their values) and see what's going on.
If the results are what you expect, then do the same thing for this line:
PHP Code:
if(strcmp($row2['fullname'],$product_name1) == 0)
See how the variables are set, and confirm your logic for that "if" condition.
-jim
Last edited by SrWebDeveloper; 10-13-2010 at 02:13 PM.
Jim, Sr. Web Developer
You know who you real friends are when you ask them to move your furniture or paint.
-
echo $product_name1."<br>"; this line reach the value , but /echo "sp='".$product_name1."'<br>"; / this line in if statement that not
-
Respectfully, your question was asked and answered, there is no need to repeat yourself.
Jim, Sr. Web Developer
You know who you real friends are when you ask them to move your furniture or paint.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
|
Bookmarks