Hi all,
I'm pretty new to php and MySql and have hit a problem.
I am able to display data in a table using the following code:
<?php
$database="MYDATABASE";
mysql_connect ("localhost", "MYUSERNAME", "MYPASSWORD");
@mysql_select_db($database) or die( "Unable to select database");
$result = mysql_query( "SELECT field1, field2, field3 FROM staff WHERE `group` = 'group1' ORDER BY `role` " )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "There are $num_rows records.<P>";
print "<table width=200 border=1>n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>n";
foreach ($get_info as $field)
print "t<td><font face=arial size=1/>$field</font></td>n";
print "</tr>n";
}
print "</table>n";
?>
However, I would like to display the results using the following format:
<div id="info"><!--this is a div contanier for info"-->
<h1> field1 </h1>
<img src="field2" class="floatLeft" /><p>field3</p>
</div><!--close info div-->
Obviously, if there was more than one row of results, it would repeat the above format for each row.
Any help would be greatly appreciated
Thanks
if else problem, help please
i have this script that i made only i try to also put in a if else for for some reason the script is not putting out the else echo. its not really a problem as the script works but it would be nice to
Passing Arguments to execlp()
I'm writing a program that mimics a unix shell. It's supposed to take commands with arguments and execute them. I'm having trouble passing in the arguments into the execlp call to correctly execute
Open browser page depending on XML results
Hello,I have some PHP code that sends webbased from data to an external url ( in the form of an XML data stream ) , and gets an XML data stream back.I've got it displaying the stream via the browser (
How to get variable value on next page
Hello friends i am working on payentry page ..there i have this code......... Code: $str="select MAX(PSRN) from paymajor";$result=mysql_query($str) or
Multiple Pages
Hi. Im very new to php. I'm trying to create a basic login/registration page.So I have a basic template (with headers and footers and stuff) - main.php. The contents are to be inside a table.The
DELETE FROM not working deletes wrong row
HelloI have the following code which i found but it doesnt work properly.. it comes up with a list of the items in the database e.g.item 1 - deleteitem 2 - delete item 3 - deletebut when i
Remote Database Access
Hey guys!!OK, i'm used to only working with databases from the CPANEL, accessing phpMyAdmin after setting up a mysql database in the cpanel.I've been asked to setup a website and the client has set up
Why use interfaces in PHP (OOP)
I am learning OOP in PHP and its been a pretty good learning experience so far. What I didn't understand at all is interfaces. I understand the implications of multiple inheritance, and interface is
Warning: session_start() headers already sent error - Driving me Nuts!
I am trying my sister in laws site and I keep getting an error with my coding. I am more of a designer than coder and I can't figure this out. It is on the following
Insert numbers from Barcode scanner into online php page
I have a real big problem, Here is what I'm trying to do. I have a Intermec CN3 handheld computer that has a builtin scanner. We have built a website that manage our inventory. How? We have a simple