开发者

retrieve value from db in php

I have a db in which 1 column value will be always null.I want it to pass to next page but it is passing all values of other column except this null value column.

This is my code

    $row=mysql_query("SELECT * FROM `thirdpartycategorymaster` WHERE ISNULL(`delete`)");
    while($row1=mysql_fetch_array($row))
    {


  <td><b><a href="catdel.php?head1=<?php echo $row1['ThirdPartyCategoryName'] . '&&msg1=' . $row1['ThirdPartyCategoryID'] . '&&ctdel=' . $row1['delete']; ?> ">Delete</a></b></td>

This my db table ThirdPartyCategoryID ThirdPartyCategoryName dele开发者_如何学编程te 29 ecommerce NULL


<?php
// ...
while($row1 = mysql_fetch_array($row)) {
?>
  <td><b><a href="catdel.php?head=<?php echo $row1['ThirdPartyCategoryName'] ?>&amp;msg1=<?php echo $row1['ThirdPartyCategoryID']?>&amp;ctdel=<?php echo ((is_null($row1['delete'])) ? 'null' : $row1['delete']) ?>">Delete</a></b></td>
<?php
}
?>

untested ... but I think it will do what you need ;-)


Well, a null value in MySQL translates to null in PHP.

If you concatenate a string with null, then you get the same string back (null becomes an empty string):

echo 'This is null: ' . null;
// prints This is null: 

What exactly do you want to pass as values? The string 'null'? If so, as all the entries hav e null in the field, you can just hardcode it:

echo $row1['ThirdPartyCategoryName'] . '&msg1=' . $row1['ThirdPartyCategoryID'] . '&ctdel=null';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜