*SOLVED* Html Table In php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Themodem
Forum Newbie
Posts: 6
Joined: Mon Feb 23, 2004 8:53 am
Location: Keighley, UK

*SOLVED* Html Table In php

Post by Themodem »

Hi

i am having trouble with the if, else statement. i can get the if part to work but u need to make the page create a table with sql queries in it in the else part.

Heres my if else statment. is there any way of putting html in the else part?

Code: Select all

<?php
if(mysql_num_rows($query_Recordset1) < 1) {
    echo "There are no cars in this section."; 
} else { 

} ;
?>
Cheers Lee
Last edited by Themodem on Wed Mar 03, 2004 10:23 am, edited 1 time in total.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Just like this mate

Code: Select all

<?php 
if(mysql_num_rows($query_Recordset1) < 1) { 
    echo "There are no cars in this section."; 
} else { 
?>

//all your HTML here


<?
} ; 
?>
Themodem
Forum Newbie
Posts: 6
Joined: Mon Feb 23, 2004 8:53 am
Location: Keighley, UK

Post by Themodem »

Thanks mate

works like a charm. its been annoying me for ages :D

Cheers
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

you can jump in and out of php as much as you like.

There are other ways of doing it. If you wanna know, just shout, but if that works for you, then stick with it :)

Mark
Post Reply