Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - gabry1234

Pages: [1]
1
Web Oriented Coding / Re: Problem with printing sql values
« on: July 08, 2014, 09:52:47 am »
thank you very much!! now it work!!

2
Web Oriented Coding / Problem with printing sql values
« on: July 04, 2014, 04:27:20 pm »
I have a problem to printing sql values with this code:

Code: [Select]
....
$con = mysqli_connect($server,$us,$pass,$database);

if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL";
}

$result = $con->query("SELECT ID,Nome,Cognome FROM Contatti WHERE ID>=0 and ID<=10 ORDER BY ID");
$row = $result->fetch_array(MYSQLI_NUM);

while($row = $result->fetch_array())
{
$rows[] = $row;
}


echo '<table border=0 cellspacing=2 cellpadding=2>';
echo ' <tr>
   <th><font size=3 face="Arial, Helvetica, sans-serif">Nome</font></th>
   <th><font size=3  face="Arial, Helvetica, sans-serif">Cognome</font></th>
 </tr>';

foreach($rows as $row)
{
echo' <tr>';
echo '<td><font size=2  face="Arial, Helvetica, sans-serif">'.$row['Nome'] . "</font></td>" ;
echo '<td><font size=2  face="Arial, Helvetica, sans-serif">'.$row['Cognome']  . "</font></td>" ;
echo' </tr>';
}
....

The problem is that the first value (in the sql extraction) is not printed

Someone can help me?

Pages: [1]