Jump to content

problem displaying result !


simzam

Recommended Posts

i cannot figure out why my first result is not displaying properly it successfully shows all results but me first

myurl.com/other.php?id=2 now showing any thing kindly help to solved this problem!  :shrug:

 

it seems like problem is in variable $http$ids but dunno how to combine them to get result $Ids always b numeric number

 

<?php
ini_set ("display_errors", "1"); 
error_reporting(E_ALL);

$http = "myurl.com/other.php?id=" ;

$conn=odbc_connect('greeting','','');
if (!$conn)
  {exit("Connection Failed: " . $conn);}
$sql="SELECT * FROM mytable";
$rs=odbc_exec($conn,$sql);
if (!$rs)
  {exit("Error in SQL");}
echo "<table border= 1><tr>";
echo "<th>ID</th>";
echo "<th>Like</th>";
echo "<th>title</th></tr>";
while (odbc_fetch_row($rs))
  {
  $ids=odbc_result($rs,"ID");
  $title=odbc_result($rs,"title");
  echo "<tr><td>$ids</td>";
  echo "<td><fb:like href=\"$http$ids\" layout=\"button_count\"  show_faces=\"false\" width=\"100\" font=\"tahoma\" colorscheme=\"dark\"></fb:like> </td>";
  echo "<td>$title</td></tr>";
  }
echo "</table>";
odbc_close($conn);
?>

Link to comment
https://forums.phpfreaks.com/topic/221992-problem-displaying-result/
Share on other sites

actually, the code highlighting threw me off, I thought you had closed out the string... it should work how you intend if the vars hold the right data, what does the output look like if you just echo it to the page (removing the dot of course)?

  echo "<td><fb:like href=\"$http$ids\" layout=\"button_count\"  show_faces=\"false\" 
width=\"100\" font=\"tahoma\" colorscheme=\"dark\"></fb:like> </td>";

 

Since you are trying to combine variables INSIDE of a double-quoted string, the dot (".") concatenation is not the answer. You need to separate the variables with curly-braces so PHP will know that they are two separate variables.

 

  echo "<td><fb:like href=\"{$http}{$ids}\" layout=\"button_count\"  show_faces=\"false\" 
width=\"100\" font=\"tahoma\" colorscheme=\"dark\"></fb:like> </td>";

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.