Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,208 members, 7,818,705 topics. Date: Sunday, 05 May 2024 at 10:17 PM

I Need Help With A Php Program - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / I Need Help With A Php Program (3700 Views)

How To Program A PHP SMS Gateway / What Is The Average Salary Of A Php Programmer In Lagos / I Need Help With A PHP Script (2) (3) (4)

(1) (2) (3) (Reply) (Go Down)

I Need Help With A Php Program by zillonnair(m): 7:49am On Apr 07, 2010
Thanks for taking your time to read through, would appreciate if you could help.

I need help with one of my PHP program, I have a form which writes to a database and the content of the database is displayed on website. This form has been working perfectly until recently when i tried to update someone's record and i couldn't see the record on the website.

Now the challenge i have is that sometimes, the form works, inputs data into the database and it shows immediately on the website but sometimes it doesn't. It inputs data into the database but doesn't show on the website, it would create spaces but no text would appear. I have checked all the links, each column and everything i know and i cant get this resolve.

If you have an idea of what could be wrong or if you would like to assist me, i could furnish you with more information. This is quiet urgent has the website has loads of hit with people entry more than 200 records daily which would not be displayed, if this is not resolved.
Re: I Need Help With A Php Program by lojik(m): 12:11pm On Apr 07, 2010
Can you post the form code and the php code that inserts to database? That way, it'll be easier to identify the problem.
Re: I Need Help With A Php Program by zillonnair(m): 12:21pm On Apr 07, 2010
Like i explained, the form seem to work fine sometimes and at other times, it doenst. Here is the code

<?

$sql = "select * from listings_areas";

$sql_result = mysql_query($sql, $connection) or die("Query 1 failed : " . mysql_error());

while ($row = mysql_fetch_array($sql_result)) {

$area_id = $row["area_id"];

$area_name = $row["area_name"];

?>

<? //body listings start here ?>

<h2><?= $area_name?></h2><br>

<?

$sql1 = "select * from listings, listings_2_categories where listings.dr_area = \"$area_id\" and listings_2_categories.listing_id = listings.dr_id

and listings_2_categories.catid = \"$pk\" order by dr_name " ;

echo "$sql1<br>";

$sql_result1 = mysql_query($sql1, $connection) or die("Query 1 failed : " . mysql_error());

while ($row1 = mysql_fetch_array($sql_result1)) {

$dr_title = $row1["dr_title"];

$dr_name = $row1["dr_name"];

$dr_business = $row1["dr_business"];

$dr_address = nl2br(trim($row1["dr_address"]));

$dr_telnum = $row1["dr_telnum"];

$dr_faxnum = $row1["dr_faxnum"];

$dr_cellnum = $row1["dr_cellnum"];

$dr_ahnum = $row1["dr_ahnum"];

$dr_email = $row1["dr_email"];

$dr_website = $row1["dr_website"];

$dr_officehours = nl2br(rtrim($row1["dr_officehours"]));

$dr_notes = nl2br(trim($row1["dr_notes"]));

$dr_focus = nl2br(trim($row1["dr_focus"]));

$dr_logo = $row1["dr_logo"];

$dr_qualification = $row1["dr_qualification"];

?>
<? if ($dr_telnum == ""wink{ ?>

<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0" bordercolor="#000000">

<tr>

<td width="12%" bordercolor="#FFFFFF">&nbsp;</td>
<td width="88%" valign="top" bordercolor="#FFFFFF">

<?

if ($dr_logo <> ""wink {

?>

<div align="center"><img src="listings/<?= $dr_logo?>" /></div>

<?

}

?>

&nbsp;

</td>

</tr>

</table>

<? } else { ?>

<table width="90%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolor="#000000">

<tr>

<td width="80%" bordercolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

<td width="23%"><strong>Name:</strong></td>

<td width="77%"><strong><?= $dr_title?> <?= $dr_name?> <? if ($dr_business <> ""wink echo " :: $dr_business";?>


<?

if ($dr_qualification <> ""wink {

?>

<?= $dr_qualification?>

<?

}

?>

</strong></td>

</tr>

<?

if ($dr_address <> ""wink {

?>

<tr>

<td valign="top">Address:</td>

<td><?= $dr_address?></td>

</tr>

<?

}

if ($dr_telnum <> ""wink {

?>

<tr>

<td>Telephone:</td>

<td><?= $dr_telnum?></td>

</tr>

<?

}

if ($dr_faxnum <> ""wink {

?>

<tr>

<td>Fax:</td>

<td><?= $dr_faxnum?></td>

</tr>

<?

}

if ($dr_cellnum <> ""wink {

?>

<tr>

<td>Cellphone:</td>

<td><?= $dr_cellnum?></td>

</tr>

<?

}

if ($dr_ahnum <> ""wink {

?>

<tr>

<td>After Hours No:</td>

<td><?= $dr_ahnum?></td>

</tr>

<?

}

if ($dr_email <> ""wink {

?>

<tr>

<td>E-mail:</td>

<td><a href="mailto:<?= $dr_email?>"><?= $dr_email?></a></td>

</tr>

<?

}

if ($dr_website <> ""wink {

?>

<tr>

<td>Website:</td>

<td><?= $dr_website?></td>

</tr>

<?

}

if ($dr_officehours <> ""wink {

?>

<tr>

<td valign="top">Office Hours:</td>

<td><?= $dr_officehours?></td>

</tr>

<?

}

if ($dr_notes <> ""wink {

?>

<tr>

<td valign="top">Notes / Special Features:</td>

<td><?= $dr_notes?></td>

</tr>

<?

}

if ($dr_focus <> ""wink {

?>

<tr>

<td valign="top">Focus Areas:</td>

<td><?= $dr_focus?></td>

</tr>

<?

}

?>

</table></td>

<td width="20%" valign="top" bordercolor="#FFFFFF">

<?

if ($dr_logo <> ""wink {

?>

<div align="center"><img src="listings/<?= $dr_logo?>" /></div>

<?

}

?>

&nbsp;

</td>

</tr>

</table>







<? } ?>

<? //body listings ends here ?>
Re: I Need Help With A Php Program by zillonnair(m): 12:24pm On Apr 07, 2010
Here is the code of the form, the first other one list the records from the form to the website.

<?
if ($Submit == "Submit"wink {
if (isset($uploaded)) unset ($uploaded);

//Image 1
if (isset($_FILES['logofile'])) {
if ($_FILES['logofile']['name'] != '' && $_FILES['logofile']['tmp_name'] != 'none')
$uploaded = $_FILES['logofile'];
}

if (isset($uploaded)) {
if ($fp = @fopen($uploaded['tmp_name'], "rb"wink) {
$uploaded['buffer'] = @fread($fp, @filesize($uploaded['tmp_name']));
@fclose ($fp);
}
$image = $uploaded['buffer'];
$ext = substr($uploaded['name'], strrpos($uploaded['name'], "."wink);
switch (strtolower($ext)) {
case '.jpeg': $uploaded['contenttype'] = 'jpeg'; break;
case '.jpg': $uploaded['contenttype'] = 'jpeg'; break;
case '.png': $uploaded['contenttype'] = 'png'; break;
case '.gif': $uploaded['contenttype'] = 'gif'; break;
}
$image_type = $uploaded['contenttype'];
srand ((double) microtime() * 100000000);
$savename = rand(100000000, 999999999) . $ext;
srand ((double) microtime() * 100000000);
$savename1_1 = rand(100000000, 999999999) . $ext;
$filename = $savepath . $savename;
if (!$handle = fopen($filename, 'w')) {
echo "Cannot open file ($filename)";
exit;
}
else {
fwrite($handle, $image);
}
fclose($handle);

$imginfo = getimagesize(", /listings/$savename"wink;
$width = $imginfo[0];
$height = $imginfo[1];
$limit = 100;
$ratio = $width / $height;

if (($width > $limit) || ($height > $limit)) {
if ($width > $height) {
$width = $limit;
$height = $width / $ratio;
}
else if ($height > $width) {
$height = $limit;
$width = $height * $ratio;
}
else {
$width = $limit;
$height = $width / $ratio;
}
$rimg=new RESIZEIMAGE(", /listings/$savename"wink;
echo $rimg->error();
$rimg->resize_limitwh($width,$height,", /listings/$savename1_1"wink;
$rimg->close();
chmod ("$savepath$savename1_1", 0777);
unlink("$savepath$savename"wink;
}
else {
rename("$savepath$savename","$savepath$savename1_1"wink;
// unlink("$savepath$savename"wink;
}
}

if ($dr_title == "Select One"wink {
$dr_title = "";
}

$sql = "insert into listings (dr_title, dr_name, dr_qualification, dr_business, dr_area, dr_logo, dr_address, dr_telnum, dr_faxnum,
dr_cellnum, dr_ahnum, dr_email, dr_website, dr_officehours, dr_notes, dr_focus) values
(\"$dr_title\", \"$dr_name\", \"$dr_qualification\", \"$dr_business\", \"$area_id\", \"$savename1_1\", \"$dr_address\", \"$dr_telnum\", \"$dr_faxnum\",
\"$dr_cellnum\", \"$dr_ahnum\", \"$dr_email\", \"$dr_website\", \"$dr_officehours\", \"$dr_notes\", \"$dr_focus\"wink";
$sql_result = mysql_query($sql, $connection) or die("Query 3 failed : " . mysql_error());

$sql = "select dr_id from listings order by dr_id desc";
$sql_result = mysql_query($sql, $connection) or die("Query 15 failed : " . mysql_error());
$row = mysql_fetch_array($sql_result);
$dr_id = $row["dr_id"];

if ($catid1 <> "0"wink {
$sql = "insert into listings_2_categories (catid, listing_id) values (\"$catid1\", \"$dr_id\"wink";
$sql_result = mysql_query($sql, $connection) or die("Query 15 failed : " . mysql_error());
}

if ($catid2 <> "0"wink {
$sql = "insert into listings_2_categories (catid, listing_id) values (\"$catid2\", \"$dr_id\"wink";
$sql_result = mysql_query($sql, $connection) or die("Query 16 failed : " . mysql_error());
}

$FromName = $dr_name;
if ($dr_email == ""wink {
$FromEmail = "sales@askthedoctonline.co.za";
}
else {
$FromEmail = $dr_email;
}

$sql = "select title from listings_categories where pk = \"$catid1\"";
$sql_result = mysql_query($sql, $connection) or die("Query 15 failed : " . mysql_error());
$row = mysql_fetch_array($sql_result);
$dr_category1 = $row["title"];

$sql = "select title from listings_categories where pk = \"$catid2\"";
$sql_result = mysql_query($sql, $connection) or die("Query 15 failed : " . mysql_error());
$row = mysql_fetch_array($sql_result);
$dr_category2 = $row["title"];

$sql = "select area_name from listings_areas where area_id = \"$area_id\"";
$sql_result = mysql_query($sql, $connection) or die("Query 15 failed : " . mysql_error());
$row = mysql_fetch_array($sql_result);
$dr_area = $row["area_name"];

$subject = "New Listing Order Received";
$sendmessage = "Name: $dr_title $dr_name\n";
$sendmessage .= "Business Name: $dr_business\n";
$sendmessage .= "Qualifications: $dr_qualification\n";
$sendmessage .= "Category 1: $dr_category1\n";
$sendmessage .= "Category 2: $dr_category2\n";
$sendmessage .= "Province: $dr_area\n";
$sendmessage .= "Address: $dr_address\n";
$sendmessage .= "Telephone: $dr_telnum\n";
$sendmessage .= "Fax: $dr_faxnum\n";
$sendmessage .= "Cellphone: $dr_cellnum\n";
$sendmessage .= "A/H Number: $dr_ahnum\n";
$sendmessage .= "Email: $dr_email\n";
$sendmessage .= "Website: $dr_website\n";
$sendmessage .= "Office Hours: $dr_email\n";
$sendmessage .= "Notes: $dr_notes\n";
$sendmessage .= "Focus Areas: $dr_focus\n";
$sendmessage .= "Listing Type: $listingtype\n";

$ToEmail = "webmaster@estart.co.za";
mail("Doctors Online <".$ToEmail.">",$subject, $sendmessage, "From: ".$FromName." <".$FromEmail.">"wink;
$ToEmail = "medical.passport@worldonline.co.za";
mail("Doctors Online <".$ToEmail.">",$subject, $sendmessage, "From: ".$FromName." <".$FromEmail.">"wink;
?>
Re: I Need Help With A Php Program by zillonnair(m): 12:45pm On Apr 07, 2010
if u wish i could send u the file and online links to ur inbox, i seriously need help. Its like the program is spaming the database or something. If i add a records it goes and everything works fine, then i add another and it doesnt show.
Re: I Need Help With A Php Program by dellnet: 1:09pm On Apr 07, 2010
Just a glance at your code does not show mysql_free_result() and mysql_close() in your code. These are very important to close connections to the database. Some webhosting services allow limited number of users per site and if you don't release your connection this sort of thing is bound to happen.


Good programming practice clean your stack before leaving.
Re: I Need Help With A Php Program by dellnet: 1:13pm On Apr 07, 2010
btw can you post the error output?
Re: I Need Help With A Php Program by zillonnair(m): 1:40pm On Apr 07, 2010
No error output whatsoever, thanks for the closing and opening you talked about.

I aint a good PHP programmer, just started out, and i inherited this code also. Like i said, everything was working perfectly fine and it still does but i just dont know what is responsible for the discrimination i get, some values are added and showing but some are added and not showing.
Re: I Need Help With A Php Program by dellnet: 1:59pm On Apr 07, 2010
one of the best ways to debug mysql is to have mysql installed on your development system. then query up your host and see whats going on. going through php is some what blind. you can download it fom http://dev.mysql.com/downloads/mysql/

it is a DOS interface you can enter into your mysql database using mysql commands and see exactly what the data looks like. It will not take you more than 15 minutes to get started using this tutorial http://dev.mysql.com/doc/refman/5.1/en/tutorial.html


Let me know if you need more help.
Re: I Need Help With A Php Program by zillonnair(m): 2:09pm On Apr 07, 2010
@ dell net

Thank you very much for your assitance.

if i understand what u mean by development system, then having wamp installed on my system would mean about the same thing.

However, i do not thing this is a mysql challenge, as all records are lodge in mysql database once the form is filled, the problem here is that, the records filled into mysql is not "echo" to the table on the website.

Meaning, instead of the texts to show, it show only white spaces, the whites spaces lets know something should have been added but the text is not displayed, could this be a mysql problem?
Re: I Need Help With A Php Program by dellnet: 2:30pm On Apr 07, 2010

<? //body listings start here ?>

<h2><?= $area_name?></h2><br>

<?

change above to

<? //body listings start here ?>

<h2><? echo $area_name;?></h2><br>

<?

Re: I Need Help With A Php Program by dellnet: 2:40pm On Apr 07, 2010
the code that sends back output to the webbrowser is incomplete and has a lot of errors in it just for example what I showed you to change. Can you post everything in the .php file that is called to show the output?

I can see unclosed while loops what not.
Re: I Need Help With A Php Program by zillonnair(m): 2:44pm On Apr 07, 2010
Here is the complete code

<?

include ("include/db_connect.php"wink;

include ("include/path.php"wink;



$pk = $_GET['pk'];



$sql = "select * from listings_categories where pk = \"$pk\"";

$sql_result = mysql_query($sql, $connection) or die("Query 1 failed : " . mysql_error());

$row = mysql_fetch_array($sql_result);

$title = $row["title"];

$title_uc = strtoupper($title);

$meta_title = $row["meta_title"];

$meta_description = $row["meta_description"];

$meta_keywords = $row["meta_keywords"];



$topad1 = $row["topad1"];

if ($topad1 == ""wink $topad1 = "bansplit.gif";



$topad1_url = $row["topad1_url"];



$topad2 = $row["topad2"];

if ($topad2 == ""wink $topad2 = "bansplit.gif";



$topad2_url = $row["topad2_url"];



$bottomad1 = $row["bottomad1"];

if ($bottomad1 == ""wink $bottomad1 = "bansplit.gif";



$bottomad1_url = $row["bottomad1_url"];



$bottomad2 = $row["bottomad2"];

if ($bottomad2 == ""wink $bottomad2 = "bansplit.gif";



$bottomad2_url = $row["bottomad2_url"];



$leftad1 = $row["leftad1"];

if ($leftad1 == ""wink $leftad1 = "advertc.gif";



$leftad1_url = $row["leftad1_url"];



$leftad2 = $row["leftad2"];

if ($leftad2 == ""wink $leftad2 = "bannerb.jpg";



$leftad2_url = $row["leftad2_url"];



$rightad1 = $row["rightad1"];

if ($rightad1 == ""wink $rightad1 = "advert.jpg";



$rightad1_url = $row["rightad1_url"];



$rightad2 = $row["rightad2"];

if ($rightad2 == ""wink $rightad2 = "advert.jpg";



$rightad2_url = $row["rightad2_url"];



$rightad3 = $row["rightad3"];

if ($rightad3 == ""wink $rightad3 = "advert.jpg";



$rightad3_url = $row["rightad3_url"];



$rightad4 = $row["rightad4"];

if ($rightad4 == ""wink $rightad4 = "advert.jpg";



$rightad4_url = $row["rightad4_url"];



$rightad5 = $row["rightad5"];

if ($rightad5 == ""wink $rightad5 = "advert.jpg";



$rightad5_url = $row["rightad5_url"];



$rightad6 = $row["rightad6"];

if ($rightad6 == ""wink $rightad6 = "advert.jpg";



$rightad6_url = $row["rightad6_url"];



$headerad1 = $row["headerad1"];

if ($headerad1 == ""wink $headerad1 = "advertpic.gif";



$headerad1_url = $row["headerad1_url"];

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script type="text/javascript" src="menu.js"></script>

<LINK HREF="default.css" TYPE="text/css" REL="stylesheet">

<title><?= $meta_title?></title>

<META NAME="TITLE" CONTENT="<?= $meta_title?>">

<META NAME="DESCRIPTION" CONTENT="<?= $meta_description?>">

<META NAME="KEYWORDS" CONTENT="<?= $meta_keywords?>">

</head>



<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="100%" border="0" cellpadding="0" cellspacing="-1" background="images/topbg1.jpg">

<tr>

<td height="134">&nbsp;</td>

<td width="559" valign="top" background="images/top2bg.jpg"><div align="right"><span class="logo"><img src="topimage.jpg" width="559" height="80" border="0" alt="" /></span></div>

<div align="right"></div></td>

</tr>

</table>

<table width="100%" border="0" cellspacing="0" cellpadding="-1">

<tr>

<td width="160" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5">

<tr>

<td><div align="center">

<?

if ($leftad1_url <> ""wink {

?>

<a href="<?= $leftad1_url?>">

<?

}

?>

<img src="listings/<?= $leftad1?>" alt="" border="0" />

<?

if ($leftad1_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

<tr>

<td>

<?

include ("menu.php"wink;

?> </td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

<tr>

<td><div align="center">

<?

if ($leftad2_url <> ""wink {

?>

<a href="<?= $leftad2_url?>">

<?

}

?>

<img src="listings/<?= $leftad2?>" alt="" border="0" />

<?

if ($leftad2_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

</table></td>

<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5">

<tr>

<td><table width="300" border="0" align="center" cellpadding="5" cellspacing="0">

<tr>

<td><div align="center">

<?

if ($topad1_url <> ""wink {

?>

<a href="<?= $topad1_url?>">

<?

}

?>

<img src="listings/<?= $topad1?>" alt="" border="0" />

<?

if ($topad1_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

<td><div align="center">

<?

if ($topad2_url <> ""wink {

?>

<a href="<?= $topad2_url?>">

<?

}

?>

<img src="listings/<?= $topad2?>" alt="" border="0" />

<?

if ($topad2_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

</table></td>

</tr>

<tr>

<td><table width="100%" border="0" cellspacing="0" cellpadding="-1">

<tr>

<td width="76%" valign="top"><h1><?= $title_uc?></h1></td>

<td width="24%"><div align="center">

<?

if ($headerad1_url <> ""wink {

?>

<a href="<?= $headerad1_url?>">

<?

}

?>

<img src="listings/<?= $headerad1?>" alt="" border="0" />

<?

if ($headerad1_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

</table></td>

</tr>

<tr>

<td>

<?

$sql = "select * from listings_areas";

$sql_result = mysql_query($sql, $connection) or die("Query 1 failed : " . mysql_error());

while ($row = mysql_fetch_array($sql_result)) {

$area_id = $row["area_id"];

$area_name = $row["area_name"];

?>

<? //body listings start here ?>

<h2><?= $area_name;?></h2><br>

<?

$sql1 = "select * from listings, listings_2_categories where listings.dr_area = \"$area_id\" and listings_2_categories.listing_id = listings.dr_id

and listings_2_categories.catid = \"$pk\" order by dr_name " ;

echo "$sql1<br>";

$sql_result1 = mysql_query($sql1, $connection) or die("Query 1 failed : " . mysql_error());

while ($row1 = mysql_fetch_array($sql_result1)) {

$dr_title = $row1["dr_title"];

$dr_name = $row1["dr_name"];

$dr_business = $row1["dr_business"];

$dr_address = nl2br(trim($row1["dr_address"]));

$dr_telnum = $row1["dr_telnum"];

$dr_faxnum = $row1["dr_faxnum"];

$dr_cellnum = $row1["dr_cellnum"];

$dr_ahnum = $row1["dr_ahnum"];

$dr_email = $row1["dr_email"];

$dr_website = $row1["dr_website"];

$dr_officehours = nl2br(rtrim($row1["dr_officehours"]));

$dr_notes = nl2br(trim($row1["dr_notes"]));

$dr_focus = nl2br(trim($row1["dr_focus"]));

$dr_logo = $row1["dr_logo"];

$dr_qualification = $row1["dr_qualification"];

?>
<? if ($dr_telnum == ""wink{ ?>

<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0" bordercolor="#000000">

<tr>

<td width="12%" bordercolor="#FFFFFF">&nbsp;</td>
<td width="88%" valign="top" bordercolor="#FFFFFF">

<?

if ($dr_logo <> ""wink {

?>

<div align="center"><img src="listings/<?= $dr_logo?>" /></div>

<?

}

?>

&nbsp;

</td>

</tr>

</table>

<? } else { ?>

<table width="90%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolor="#000000">

<tr>

<td width="80%" bordercolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

<td width="23%"><strong>Name:</strong></td>

<td width="77%"><strong><?= $dr_title?> <?= $dr_name?> <? if ($dr_business <> ""wink echo " :: $dr_business";?>


<?

if ($dr_qualification <> ""wink {

?>

<?= $dr_qualification?>

<?

}

?>

</strong></td>

</tr>

<?

if ($dr_address <> ""wink {

?>

<tr>

<td valign="top">Address:</td>

<td><?= $dr_address?></td>

</tr>

<?

}

if ($dr_telnum <> ""wink {

?>

<tr>

<td>Telephone:</td>

<td><?= $dr_telnum?></td>

</tr>

<?

}

if ($dr_faxnum <> ""wink {

?>

<tr>

<td>Fax:</td>

<td><?= $dr_faxnum?></td>

</tr>

<?

}

if ($dr_cellnum <> ""wink {

?>

<tr>

<td>Cellphone:</td>

<td><?= $dr_cellnum?></td>

</tr>

<?

}

if ($dr_ahnum <> ""wink {

?>

<tr>

<td>After Hours No:</td>

<td><?= $dr_ahnum?></td>

</tr>

<?

}

if ($dr_email <> ""wink {

?>

<tr>

<td>E-mail:</td>

<td><a href="mailto:<?= $dr_email?>"><?= $dr_email?></a></td>

</tr>

<?

}

if ($dr_website <> ""wink {

?>

<tr>

<td>Website:</td>

<td><?= $dr_website?></td>

</tr>

<?

}

if ($dr_officehours <> ""wink {

?>

<tr>

<td valign="top">Office Hours:</td>

<td><?= $dr_officehours?></td>

</tr>

<?

}

if ($dr_notes <> ""wink {

?>

<tr>

<td valign="top">Notes / Special Features:</td>

<td><?= $dr_notes?></td>

</tr>

<?

}

if ($dr_focus <> ""wink {

?>

<tr>

<td valign="top">Focus Areas:</td>

<td><?= $dr_focus?></td>

</tr>

<?

}

?>

</table></td>

<td width="20%" valign="top" bordercolor="#FFFFFF">

<?

if ($dr_logo <> ""wink {

?>

<div align="center"><img src="listings/<?= $dr_logo?>" /></div>

<?

}

?>

&nbsp;

</td>

</tr>

</table>







<? } ?>

<? //body listings ends here ?>

<br>

<?

}

}



?> </td>

</tr>

<tr>

<td><table width="300" border="0" align="center" cellpadding="5" cellspacing="0">

<tr>

<td><div align="center">

<?

if ($bottomad1_url <> ""wink {

?>

<a href="<?= $bottomad1_url?>">

<?

}

?>

<img src="listings/<?= $bottomad1?>" alt="" border="0" />

<?

if ($bottomad1_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

<td><div align="center">

<?

if ($bottomad2_url <> ""wink {

?>

<a href="<?= $bottomad2_url?>">

<?

}

?>

<img src="listings/<?= $bottomad2?>" alt="" border="0" />

<?

if ($bottomad2_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

</table></td>

</tr>

</table>

</td>

<td width="160" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5">

<tr>

<td><div align="center">

<?

if ($rightad1_url <> ""wink {

?>

<a href="<?= $rightad1_url?>">

<?

}

?>

<img src="listings/<?= $rightad1?>" alt="" border="0" />

<?

if ($rightad1_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

<tr>

<td><div align="center">

<?

if ($rightad2_url <> ""wink {

?>

<a href="<?= $rightad2_url?>">

<?

}

?>

<img src="listings/<?= $rightad2?>" alt="" border="0" />

<?

if ($rightad2_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

<tr>

<td><div align="center">

<?

if ($rightad3_url <> ""wink {

?>

<a href="<?= $rightad3_url?>">

<?

}

?>

<img src="listings/<?= $rightad3?>" alt="" border="0" />

<?

if ($rightad3_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

<tr>

<td><div align="center">

<?

if ($rightad4_url <> ""wink {

?>

<a href="<?= $rightad4_url?>">

<?

}

?>

<img src="listings/<?= $rightad4?>" alt="" border="0" />

<?

if ($rightad4_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

<tr>

<td><div align="center">

<?

if ($rightad5_url <> ""wink {

?>

<a href="<?= $rightad1_ur5?>">

<?

}

?>

<img src="listings/<?= $rightad5?>" alt="" border="0" />

<?

if ($rightad5_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

<tr>

<td><div align="center">

<?



?>

<a href="<?= $rightad6_url?>">

<?



?>

<img src="listings/<?= $rightad6?>" alt="" border="0" />

<?



?>

</a>

<?



?>

</div></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

</table></td>

</tr>

</table>

<table width="700" border="0" align="center" cellpadding="5" cellspacing="0">

<tr>

<td>

<div class="center">

<p class="foot">Note: Dear users, prescribing medications online or giving a diagnosis contradicts







medical ethics, which is why Doctors Online can only offer General information's and advise you on what medical professional to consult.</p>

</div>

</td>

</tr>

</table>

<?

include("footertext.php"wink;

?>

</body>

</html>
Re: I Need Help With A Php Program by zillonnair(m): 2:58pm On Apr 07, 2010
I just added the semicolon you asked me to and listed a new record, same result, white blank space, no text but it inserted into the database. If u could help, i did appreciate.
Re: I Need Help With A Php Program by zillonnair(m): 3:00pm On Apr 07, 2010
i think the moderator didn't allow the full code i just submitted, if you send me ur email i will forward u the files.
Re: I Need Help With A Php Program by dellnet: 3:04pm On Apr 07, 2010

<?
//$connection = mysql_connect('localhost', 'user', 'password');


$sql = "select * from listings_areas";

$sql_result = mysql_query($sql, $connection) or die("Query 1 failed : " . mysql_error());  

if ($row = mysql_fetch_array($sql_result, MYSQL_ASSOC)) ) // this will fetch the first row only
{
$area_id = $row["area_id"];

$area_name = $row["area_name"];

echo 'this is area_name'.$area_name.'<br>';
mysql_free_result($sql_result);
}
else
{
echo 'unable to get area_id and area_name<br>';
mysql_free_result($sql_result);
exit();
}
$sql1 = "select * from listings, listings_2_categories where listings.dr_area = \"$area_id\" and listings_2_categories.listing_id = listings.dr_id

   and listings_2_categories.catid = \"$pk\" order by dr_name " ;

 echo "$sql1<br>";

 $sql_result1 = mysql_query($sql1, $connection) or die("Query 1 failed : " . mysql_error());  

 while ($row1 = mysql_fetch_array($sql_result1, MYSQL_BOTH)) {
echo $row[0]." ".$row[1]; //print first 2 columns in each row.
}

// release result and close connection to db.
mysql_free_result($sql_result1);
mysql_close($connection);
?>



ok try this. replace this code with the content of the.php file that sends output to the webbrowser make sure you make a copy before replacing.
uncomment //$connection = mysql_connect('localhost', 'user', 'password'); in the code and put valid values that is the server to connect to, username and password. Let us know if it works.
Re: I Need Help With A Php Program by dellnet: 3:11pm On Apr 07, 2010
correction:
at line 9 take out one closing parenthesis.

if ($row = mysql_fetch_array($sql_result, MYSQL_ASSOC)) ) // this will fetch the first row only
change to
if ($row = mysql_fetch_array($sql_result, MYSQL_ASSOC)) // this will fetch the first row only

sorry fast fingers.
Re: I Need Help With A Php Program by zillonnair(m): 3:19pm On Apr 07, 2010
thanks,

i am sort of confuse at this point, i know you are aware there are two php programs there, one is the first one that is used to generate the html site itself and the other is to display the text from the database.

if i am to replace the entire content with this code u supply, then there wont be any page.

my email is samuelchukzay@gmail.com, i can send the files to you.
Re: I Need Help With A Php Program by dellnet: 3:33pm On Apr 07, 2010
Here is the code of the form, the first other one list the records from the form to the website.

I am talking about the first one. Are the programs in a single file? you may use this medium to send the contents of the file(s) dont attach the file(s) just copy and paste the contents in the reply box. From the tools menu above the reply box click on the # button and insert the text in between the first code [] and last.
Re: I Need Help With A Php Program by zillonnair(m): 3:36pm On Apr 07, 2010
i replaced the part that retrieves data from the data and i got this error

Parse error: syntax error, unexpected '<' in /home/askthedo/public_html/listings.php  on line 451

and on that line its the connection part
Re: I Need Help With A Php Program by dellnet: 3:42pm On Apr 07, 2010
check if connection is already open i.e. if $connection = mysql_connect, has already been called if so comment line 451. 451 lines of code thats huge. well not really but for a starter it is. smiley
Re: I Need Help With A Php Program by dellnet: 3:46pm On Apr 07, 2010
also you can put a closing tag before <.

< is refering to the opening tag that is the line containing <?

there should be no < at the line that does the connection.
A closing tag is ?>
Re: I Need Help With A Php Program by zillonnair(m): 3:48pm On Apr 07, 2010
[/code]<?

include ("include/db_connect.php"wink;

include ("include/path.php"wink;



$pk = $_GET['pk'];



$sql = "select * from listings_categories where pk = \"$pk\"";

$sql_result = mysql_query($sql, $connection) or die("Query 1 failed : " . mysql_error());  

$row = mysql_fetch_array($sql_result);

$title = $row["title"];

$title_uc = strtoupper($title);

$meta_title = $row["meta_title"];

$meta_description = $row["meta_description"];

$meta_keywords = $row["meta_keywords"];



$topad1 = $row["topad1"];

if ($topad1 == ""wink $topad1 = "bansplit.gif";



$topad1_url = $row["topad1_url"];



$topad2 = $row["topad2"];

if ($topad2 == ""wink $topad2 = "bansplit.gif";



$topad2_url = $row["topad2_url"];



$bottomad1 = $row["bottomad1"];

if ($bottomad1 == ""wink $bottomad1 = "bansplit.gif";



$bottomad1_url = $row["bottomad1_url"];



$bottomad2 = $row["bottomad2"];

if ($bottomad2 == ""wink $bottomad2 = "bansplit.gif";



$bottomad2_url = $row["bottomad2_url"];



$leftad1 = $row["leftad1"];

if ($leftad1 == ""wink $leftad1 = "advertc.gif";



$leftad1_url = $row["leftad1_url"];



$leftad2 = $row["leftad2"];

if ($leftad2 == ""wink $leftad2 = "bannerb.jpg";



$leftad2_url = $row["leftad2_url"];



$rightad1 = $row["rightad1"];

if ($rightad1 == ""wink $rightad1 = "advert.jpg";



$rightad1_url = $row["rightad1_url"];



$rightad2 = $row["rightad2"];

if ($rightad2 == ""wink $rightad2 = "advert.jpg";



$rightad2_url = $row["rightad2_url"];



$rightad3 = $row["rightad3"];

if ($rightad3 == ""wink $rightad3 = "advert.jpg";



$rightad3_url = $row["rightad3_url"];



$rightad4 = $row["rightad4"];

if ($rightad4 == ""wink $rightad4 = "advert.jpg";



$rightad4_url = $row["rightad4_url"];



$rightad5 = $row["rightad5"];

if ($rightad5 == ""wink $rightad5 = "advert.jpg";



$rightad5_url = $row["rightad5_url"];



$rightad6 = $row["rightad6"];

if ($rightad6 == ""wink $rightad6 = "advert.jpg";



$rightad6_url = $row["rightad6_url"];



$headerad1 = $row["headerad1"];

if ($headerad1 == ""wink $headerad1 = "advertpic.gif";



$headerad1_url = $row["headerad1_url"];

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script type="text/javascript" src="menu.js"></script>

<LINK HREF="default.css" TYPE="text/css" REL="stylesheet">

<title><?= $meta_title?></title>

<META NAME="TITLE" CONTENT="<?= $meta_title?>">

<META NAME="DESCRIPTION" CONTENT="<?= $meta_description?>">

<META NAME="KEYWORDS" CONTENT="<?= $meta_keywords?>">

</head>



<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="100%" border="0" cellpadding="0" cellspacing="-1" background="images/topbg1.jpg">

 <tr>

   <td height="134">&nbsp;</td>

   <td width="559" valign="top" background="images/top2bg.jpg"><div align="right"><span class="logo"><img src="topimage.jpg" width="559" height="80" border="0" alt="" /></span></div>

       <div align="right"></div></td>

 </tr>

</table>

<table width="100%" border="0" cellspacing="0" cellpadding="-1">

 <tr>

   <td width="160" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5">

     <tr>

       <td><div align="center">

<?

if ($leftad1_url <> ""wink {

?>        

       <a href="<?= $leftad1_url?>">

<?

}

?>        

       <img src="listings/<?= $leftad1?>" alt="" border="0" />

<?

if ($leftad1_url <> ""wink {

?>        

       </a>

<?

}

?>        

       </div></td>

       </tr>

     <tr>

       <td>&nbsp;</td>

     </tr>

     <tr>

       <td>

<?

include ("menu.php"wink;

?>        </td>

     </tr>

     <tr>

       <td>&nbsp;</td>

     </tr>

     <tr>

       <td><div align="center">

<?

if ($leftad2_url <> ""wink {

?>        

       <a href="<?= $leftad2_url?>">

<?

}

?>        

       <img src="listings/<?= $leftad2?>" alt="" border="0" />

<?

if ($leftad2_url <> ""wink {

?>        

       </a>

<?

}

?>        

       </div></td>

     </tr>

     <tr>

       <td>&nbsp;</td>

     </tr>

   </table></td>

   <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5">

     <tr>

       <td><table width="300" border="0" align="center" cellpadding="5" cellspacing="0">

         <tr>

           <td><div align="center">

               <?

if ($topad1_url <> ""wink {

?>

               <a href="<?= $topad1_url?>">

               <?

}

?>

               <img src="listings/<?= $topad1?>" alt="" border="0" />

               <?

if ($topad1_url <> ""wink {

?>

               </a>

               <?

}

?>

           </div></td>

           <td><div align="center">

               <?

if ($topad2_url <> ""wink {

?>

               <a href="<?= $topad2_url?>">

               <?

}

?>

               <img src="listings/<?= $topad2?>" alt="" border="0" />

               <?

if ($topad2_url <> ""wink {

?>

               </a>

               <?

}

?>

           </div></td>

         </tr>

       </table></td>

       </tr>

     <tr>

       <td><table width="100%" border="0" cellspacing="0" cellpadding="-1">

         <tr>

           <td width="76%" valign="top"><h1><?= $title_uc?></h1></td>

           <td width="24%"><div align="center">

<?

if ($headerad1_url <> ""wink {

?>

             <a href="<?= $headerad1_url?>">

             <?

}

?>

             <img src="listings/<?= $headerad1?>" alt="" border="0" />

             <?

if ($headerad1_url <> ""wink {

?>

             </a>

             <?

}

?>

           </div></td>

           </tr>

       </table></td>

     </tr>

     <tr>

       <td>

<?

$sql = "select * from listings_areas";

$sql_result = mysql_query($sql, $connection) or die("Query 1 failed : " . mysql_error());  

while ($row = mysql_fetch_array($sql_result)) {

 $area_id = $row["area_id"];

 $area_name = $row["area_name"];

?>        

<? //body listings start here ?>

       <h2><?= $area_name?></h2><br>

<?

 $sql1 = "select * from listings, listings_2_categories where listings.dr_area = \"$area_id\" and listings_2_categories.listing_id = listings.dr_id

   and listings_2_categories.catid = \"$pk\" order by dr_name " ;

 echo "$sql1<br>";

 $sql_result1 = mysql_query($sql1, $connection) or die("Query 1 failed : " . mysql_error());  

 while ($row1 = mysql_fetch_array($sql_result1)) {

   $dr_title = $row1["dr_title"];

   $dr_name = $row1["dr_name"];

   $dr_business = $row1["dr_business"];

   $dr_address = nl2br(trim($row1["dr_address"]));

   $dr_telnum = $row1["dr_telnum"];

   $dr_faxnum = $row1["dr_faxnum"];

   $dr_cellnum = $row1["dr_cellnum"];

   $dr_ahnum = $row1["dr_ahnum"];

   $dr_email = $row1["dr_email"];

   $dr_website = $row1["dr_website"];

   $dr_officehours = nl2br(rtrim($row1["dr_officehours"]));

   $dr_notes = nl2br(trim($row1["dr_notes"]));

   $dr_focus = nl2br(trim($row1["dr_focus"]));

   $dr_logo = $row1["dr_logo"];

   $dr_qualification = $row1["dr_qualification"];

?>
<? if ($dr_telnum  == ""wink{  ?>

       <table width="90%" border="0" align="center" cellpadding="3" cellspacing="0" bordercolor="#000000">

         <tr>

           <td width="12%" bordercolor="#FFFFFF">&nbsp;</td>
           <td width="88%" valign="top" bordercolor="#FFFFFF">

<?

if ($dr_logo <> ""wink {

?>            

           <div align="center"><img src="listings/<?= $dr_logo?>" /></div>

<?

}

?>

           &nbsp;

           </td>

           </tr>

       </table>

<? }   else { ?>

<table width="90%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolor="#000000">

         <tr>

           <td width="80%" bordercolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">

             <tr>

               <td width="23%"><strong>Name:</strong></td>

               <td width="77%"><strong><?= $dr_title?> <?= $dr_name?> <? if ($dr_business <> ""wink echo " :: $dr_business";?>


<?

if ($dr_qualification <> ""wink {

?>                  

                 <?= $dr_qualification?>

<?

}

?>

                 </strong></td>

             </tr>

<?

if ($dr_address <> ""wink {

?>                  

             <tr>

               <td valign="top">Address:</td>

               <td><?= $dr_address?></td>

             </tr>

<?

}

if ($dr_telnum <> ""wink {

?>

             <tr>

               <td>Telephone:</td>

               <td><?= $dr_telnum?></td>

             </tr>

<?

}

if ($dr_faxnum <> ""wink {

?>

             <tr>

               <td>Fax:</td>

               <td><?= $dr_faxnum?></td>

             </tr>

<?

}

if ($dr_cellnum <> ""wink {

?>

             <tr>

               <td>Cellphone:</td>

               <td><?= $dr_cellnum?></td>

             </tr>

<?

}

if ($dr_ahnum <> ""wink {

?>

             <tr>

               <td>After Hours No:</td>

               <td><?= $dr_ahnum?></td>

             </tr>

<?

}

if ($dr_email <> ""wink {

?>

             <tr>

               <td>E-mail:</td>

               <td><a href="mailto:<?= $dr_email?>"><?= $dr_email?></a></td>

             </tr>

<?

}

if ($dr_website <> ""wink {

?>

             <tr>

               <td>Website:</td>

               <td><?= $dr_website?></td>

             </tr>

<?

}

if ($dr_officehours <> ""wink {

?>

             <tr>

               <td valign="top">Office Hours:</td>

               <td><?= $dr_officehours?></td>

             </tr>

<?

}

if ($dr_notes <> ""wink {

?>

             <tr>

               <td valign="top">Notes / Special Features:</td>

               <td><?= $dr_notes?></td>

             </tr>

<?

}

if ($dr_focus <> ""wink {

?>

             <tr>

               <td valign="top">Focus Areas:</td>

               <td><?= $dr_focus?></td>

             </tr>

<?

}

?>

           </table></td>

           <td width="20%" valign="top" bordercolor="#FFFFFF">

<?

if ($dr_logo <> ""wink {

?>            

           <div align="center"><img src="listings/<?= $dr_logo?>" /></div>

<?

}

?>

           &nbsp;

           </td>

           </tr>

       </table>







<? }  ?>

<? //body listings ends here ?>

       <br>

<?

 }

}



?>        </td>

     </tr>

     <tr>

       <td><table width="300" border="0" align="center" cellpadding="5" cellspacing="0">

         <tr>

           <td><div align="center">

<?

if ($bottomad1_url <> ""wink {

?>

               <a href="<?= $bottomad1_url?>">

<?

}

?>

               <img src="listings/<?= $bottomad1?>" alt="" border="0" />

<?

if ($bottomad1_url <> ""wink {

?>

               </a>

<?

}

?>

           </div></td>

           <td><div align="center">

               <?

if ($bottomad2_url <> ""wink {

?>

               <a href="<?= $bottomad2_url?>">

<?

}

?>

               <img src="listings/<?= $bottomad2?>" alt="" border="0" />

               <?

if ($bottomad2_url <> ""wink {

?>

               </a>

<?

}

?>

           </div></td>

         </tr>

       </table></td>

     </tr>

   </table>

   </td>

   <td width="160" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5">

     <tr>

       <td><div align="center">

<?

if ($rightad1_url <> ""wink {

?>

       <a href="<?= $rightad1_url?>">

<?

}

?>

       <img src="listings/<?= $rightad1?>" alt="" border="0" />

<?

if ($rightad1_url <> ""wink {

?>

       </a>

<?

}

?>

       </div></td>

       </tr>

     <tr>

       <td>&nbsp;</td>

     </tr>

     <tr>

       <td><div align="center">

<?

if ($rightad2_url <> ""wink {

?>

       <a href="<?= $rightad2_url?>">

<?

}

?>

       <img src="listings/<?= $rightad2?>" alt="" border="0" />

<?

if ($rightad2_url <> ""wink {

?>

       </a>

<?

}

?>

       </div></td>

     </tr>

     <tr>

       <td>&nbsp;</td>

     </tr>

     <tr>

       <td><div align="center">

<?

if ($rightad3_url <> ""wink {

?>

       <a href="<?= $rightad3_url?>">

<?

}

?>

       <img src="listings/<?= $rightad3?>" alt="" border="0" />

<?

if ($rightad3_url <> ""wink {

?>

       </a>

<?

}

?>

       </div></td>

     </tr>

     <tr>

       <td>&nbsp;</td>

     </tr>

     <tr>

       <td><div align="center">

<?

if ($rightad4_url <> ""wink {

?>

       <a href="<?= $rightad4_url?>">

<?

}

?>

       <img src="listings/<?= $rightad4?>" alt="" border="0" />

<?

if ($rightad4_url <> ""wink {

?>

       </a>

<?

}

?>

       </div></td>

     </tr>

     <tr>

       <td>&nbsp;</td>

     </tr>

     <tr>

       <td><div align="center">

<?

if ($rightad5_url <> ""wink {

?>

       <a href="<?= $rightad1_ur5?>">

<?

}

?>

       <img src="listings/<?= $rightad5?>" alt="" border="0" />

<?

if ($rightad5_url <> ""wink {

?>

       </a>

<?

}

?>

       </div></td>

     </tr>

     <tr>

       <td>&nbsp;</td>

     </tr>

     <tr>

       <td><div align="center">

<?



?>

       <a href="<?= $rightad6_url?>">

<?



?>

       <img src="listings/<?= $rightad6?>" alt="" border="0" />

<?



?>

       </a>

<?



?>

       </div></td>

     </tr>

     <tr>

       <td>&nbsp;</td>

     </tr>

   </table></td>

 </tr>

</table>

<table width="700" border="0" align="center" cellpadding="5" cellspacing="0">

 <tr>

   <td>

   <div class="center">

<p class="foot">Note: Dear users, prescribing medications online or giving a diagnosis contradicts







medical ethics, which is why Doctors Online can only offer General information's and advise you on what medical professional to consult.</p>

</div>

   </td>

 </tr>

</table>

<?

include("footertext.php"wink;

?>

</body>

</html>[code]
Re: I Need Help With A Php Program by zillonnair(m): 3:51pm On Apr 07, 2010
yes, the connection was already open so comment that line 451, still same problem
Re: I Need Help With A Php Program by dellnet: 3:53pm On Apr 07, 2010
copy and paste the code here.
Re: I Need Help With A Php Program by dellnet: 3:53pm On Apr 07, 2010
all of it.
Re: I Need Help With A Php Program by zillonnair(m): 3:56pm On Apr 07, 2010
i just did, infact i have done it thrice and i used the method u specified
Re: I Need Help With A Php Program by dellnet: 3:58pm On Apr 07, 2010
break it into chunks may 80 lines or less per post
Re: I Need Help With A Php Program by sayhi2ay(m): 4:02pm On Apr 07, 2010
perhaps he can do a screen shot and post it as an image instead?

why wont you just "echo" your output ?
Re: I Need Help With A Php Program by zillonnair(m): 4:03pm On Apr 07, 2010
<?

include ("include/db_connect.php"wink;

include ("include/path.php"wink;



$pk = $_GET['pk'];



$sql = "select * from listings_categories where pk = \"$pk\"";

$sql_result = mysql_query($sql, $connection) or die("Query 1 failed : " . mysql_error());

$row = mysql_fetch_array($sql_result);

$title = $row["title"];

$title_uc = strtoupper($title);

$meta_title = $row["meta_title"];

$meta_description = $row["meta_description"];

$meta_keywords = $row["meta_keywords"];



$topad1 = $row["topad1"];

if ($topad1 == ""wink $topad1 = "bansplit.gif";



$topad1_url = $row["topad1_url"];



$topad2 = $row["topad2"];

if ($topad2 == ""wink $topad2 = "bansplit.gif";



$topad2_url = $row["topad2_url"];



$bottomad1 = $row["bottomad1"];

if ($bottomad1 == ""wink $bottomad1 = "bansplit.gif";



$bottomad1_url = $row["bottomad1_url"];



$bottomad2 = $row["bottomad2"];

if ($bottomad2 == ""wink $bottomad2 = "bansplit.gif";



$bottomad2_url = $row["bottomad2_url"];



$leftad1 = $row["leftad1"];

if ($leftad1 == ""wink $leftad1 = "advertc.gif";



$leftad1_url = $row["leftad1_url"];

[code][/code]
Re: I Need Help With A Php Program by zillonnair(m): 4:05pm On Apr 07, 2010
<?

include ("include/db_connect.php"wink;

include ("include/path.php"wink;



$pk = $_GET['pk'];



$sql = "select * from listings_categories where pk = \"$pk\"";

$sql_result = mysql_query($sql, $connection) or die("Query 1 failed : " . mysql_error());

$row = mysql_fetch_array($sql_result);

$title = $row["title"];

$title_uc = strtoupper($title);

$meta_title = $row["meta_title"];

$meta_description = $row["meta_description"];

$meta_keywords = $row["meta_keywords"];



$topad1 = $row["topad1"];

if ($topad1 == ""wink $topad1 = "bansplit.gif";



$topad1_url = $row["topad1_url"];



$topad2 = $row["topad2"];

if ($topad2 == ""wink $topad2 = "bansplit.gif";



$topad2_url = $row["topad2_url"];



$bottomad1 = $row["bottomad1"];

if ($bottomad1 == ""wink $bottomad1 = "bansplit.gif";



$bottomad1_url = $row["bottomad1_url"];



$bottomad2 = $row["bottomad2"];

if ($bottomad2 == ""wink $bottomad2 = "bansplit.gif";



$bottomad2_url = $row["bottomad2_url"];



$leftad1 = $row["leftad1"];

if ($leftad1 == ""wink $leftad1 = "advertc.gif";



$leftad1_url = $row["leftad1_url"];



$leftad2 = $row["leftad2"];

if ($leftad2 == ""wink $leftad2 = "bannerb.jpg";



$leftad2_url = $row["leftad2_url"];



$rightad1 = $row["rightad1"];

if ($rightad1 == ""wink $rightad1 = "advert.jpg";



$rightad1_url = $row["rightad1_url"];



$rightad2 = $row["rightad2"];

if ($rightad2 == ""wink $rightad2 = "advert.jpg";



$rightad2_url = $row["rightad2_url"];



$rightad3 = $row["rightad3"];

if ($rightad3 == ""wink $rightad3 = "advert.jpg";



$rightad3_url = $row["rightad3_url"];



$rightad4 = $row["rightad4"];

if ($rightad4 == ""wink $rightad4 = "advert.jpg";



$rightad4_url = $row["rightad4_url"];



$rightad5 = $row["rightad5"];

if ($rightad5 == ""wink $rightad5 = "advert.jpg";



$rightad5_url = $row["rightad5_url"];



$rightad6 = $row["rightad6"];

if ($rightad6 == ""wink $rightad6 = "advert.jpg";



$rightad6_url = $row["rightad6_url"];



$headerad1 = $row["headerad1"];

if ($headerad1 == ""wink $headerad1 = "advertpic.gif";



$headerad1_url = $row["headerad1_url"];

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script type="text/javascript" src="menu.js"></script>

<LINK HREF="default.css" TYPE="text/css" REL="stylesheet">

<title><?= $meta_title?></title>

<META NAME="TITLE" CONTENT="<?= $meta_title?>">

<META NAME="DESCRIPTION" CONTENT="<?= $meta_description?>">

<META NAME="KEYWORDS" CONTENT="<?= $meta_keywords?>">

</head>



<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="100%" border="0" cellpadding="0" cellspacing="-1" background="images/topbg1.jpg">

<tr>

<td height="134">&nbsp;</td>

<td width="559" valign="top" background="images/top2bg.jpg"><div align="right"><span class="logo"><img src="topimage.jpg" width="559" height="80" border="0" alt="" /></span></div>

<div align="right"></div></td>

</tr>

</table>

<table width="100%" border="0" cellspacing="0" cellpadding="-1">

<tr>

<td width="160" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5">

<tr>

<td><div align="center">

<?

if ($leftad1_url <> ""wink {

?>

<a href="<?= $leftad1_url?>">

<?

}

?>

<img src="listings/<?= $leftad1?>" alt="" border="0" />

<?

if ($leftad1_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

<tr>

<td>

<?

include ("menu.php"wink;

?> </td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

<tr>

<td><div align="center">

<?

if ($leftad2_url <> ""wink {

?>

<a href="<?= $leftad2_url?>">

<?

}

?>

<img src="listings/<?= $leftad2?>" alt="" border="0" />

<?

if ($leftad2_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

</table></td>

<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5">

<tr>

<td><table width="300" border="0" align="center" cellpadding="5" cellspacing="0">

<tr>

<td><div align="center">

<?

if ($topad1_url <> ""wink {

?>

<a href="<?= $topad1_url?>">

<?

}

?>

<img src="listings/<?= $topad1?>" alt="" border="0" />

<?

if ($topad1_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

<td><div align="center">

<?

if ($topad2_url <> ""wink {

?>

<a href="<?= $topad2_url?>">

<?

}

?>

<img src="listings/<?= $topad2?>" alt="" border="0" />

<?

if ($topad2_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

</table></td>

</tr>

<tr>

<td><table width="100%" border="0" cellspacing="0" cellpadding="-1">

<tr>

<td width="76%" valign="top"><h1><?= $title_uc?></h1></td>

<td width="24%"><div align="center">

<?

if ($headerad1_url <> ""wink {

?>

<a href="<?= $headerad1_url?>">

<?

}

?>

<img src="listings/<?= $headerad1?>" alt="" border="0" />

<?

if ($headerad1_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

</table></td>

</tr>

<tr>

<td>

<?

$sql = "select * from listings_areas";

$sql_result = mysql_query($sql, $connection) or die("Query 1 failed : " . mysql_error());

while ($row = mysql_fetch_array($sql_result)) {

$area_id = $row["area_id"];

$area_name = $row["area_name"];

?>

<? //body listings start here ?>

<h2><?= $area_name?></h2><br>

<?

$sql1 = "select * from listings, listings_2_categories where listings.dr_area = \"$area_id\" and listings_2_categories.listing_id = listings.dr_id

and listings_2_categories.catid = \"$pk\" order by dr_name " ;

//echo "$sql1<br>";

$sql_result1 = mysql_query($sql1, $connection) or die("Query 1 failed : " . mysql_error());

while ($row1 = mysql_fetch_array($sql_result1)) {

$dr_title = $row1["dr_title"];

$dr_name = $row1["dr_name"];

$dr_business = $row1["dr_business"];

$dr_address = nl2br(trim($row1["dr_address"]));

$dr_telnum = $row1["dr_telnum"];

$dr_faxnum = $row1["dr_faxnum"];

$dr_cellnum = $row1["dr_cellnum"];

$dr_ahnum = $row1["dr_ahnum"];

$dr_email = $row1["dr_email"];

$dr_website = $row1["dr_website"];

$dr_officehours = nl2br(rtrim($row1["dr_officehours"]));

$dr_notes = nl2br(trim($row1["dr_notes"]));

$dr_focus = nl2br(trim($row1["dr_focus"]));

$dr_logo = $row1["dr_logo"];

$dr_qualification = $row1["dr_qualification"];

?>
<? if ($dr_telnum == ""wink{ ?>

<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0" bordercolor="#000000">

<tr>

<td width="12%" bordercolor="#FFFFFF">&nbsp;</td>
<td width="88%" valign="top" bordercolor="#FFFFFF">

<?

if ($dr_logo <> ""wink {

?>

<div align="center"><img src="listings/<?= $dr_logo?>" /></div>

<?

}

?>

&nbsp;

</td>

</tr>

</table>

<? } else { ?>

<table width="90%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolor="#000000">

<tr>

<td width="80%" bordercolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

<td width="23%"><strong>Name:</strong></td>

<td width="77%"><strong><?= $dr_title?> <?= $dr_name?> <? if ($dr_business <> ""wink echo " :: $dr_business";?>


<?

if ($dr_qualification <> ""wink {

?>

<?= $dr_qualification?>

<?

}

?>

</strong></td>

</tr>

<?

if ($dr_address <> ""wink {

?>

<tr>

<td valign="top">Address:</td>

<td><?= $dr_address?></td>

</tr>

<?

}

if ($dr_telnum <> ""wink {

?>

<tr>

<td>Telephone:</td>

<td><?= $dr_telnum?></td>

</tr>

<?

}

if ($dr_faxnum <> ""wink {

?>

<tr>

<td>Fax:</td>

<td><?= $dr_faxnum?></td>

</tr>

<?

}

if ($dr_cellnum <> ""wink {

?>

<tr>

<td>Cellphone:</td>

<td><?= $dr_cellnum?></td>

</tr>

<?

}

if ($dr_ahnum <> ""wink {

?>

<tr>

<td>After Hours No:</td>

<td><?= $dr_ahnum?></td>

</tr>

<?

}

if ($dr_email <> ""wink {

?>

<tr>

<td>E-mail:</td>

<td><a href="mailto:<?= $dr_email?>"><?= $dr_email?></a></td>

</tr>

<?

}

if ($dr_website <> ""wink {

?>

<tr>

<td>Website:</td>

<td><?= $dr_website?></td>

</tr>

<?

}

if ($dr_officehours <> ""wink {

?>

<tr>

<td valign="top">Office Hours:</td>

<td><?= $dr_officehours?></td>

</tr>

<?

}

if ($dr_notes <> ""wink {

?>

<tr>

<td valign="top">Notes / Special Features:</td>

<td><?= $dr_notes?></td>

</tr>

<?

}

if ($dr_focus <> ""wink {

?>

<tr>

<td valign="top">Focus Areas:</td>

<td><?= $dr_focus?></td>

</tr>

<?

}

?>

</table></td>

<td width="20%" valign="top" bordercolor="#FFFFFF">

<?

if ($dr_logo <> ""wink {

?>

<div align="center"><img src="listings/<?= $dr_logo?>" /></div>

<?

}

?>

&nbsp;

</td>

</tr>

</table>







<? } ?>

<? //body listings ends here ?>

<br>

<?

}

}



?> </td>

</tr>

<tr>

<td><table width="300" border="0" align="center" cellpadding="5" cellspacing="0">

<tr>

<td><div align="center">

<?

if ($bottomad1_url <> ""wink {

?>

<a href="<?= $bottomad1_url?>">

<?

}

?>

<img src="listings/<?= $bottomad1?>" alt="" border="0" />

<?

if ($bottomad1_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

<td><div align="center">

<?

if ($bottomad2_url <> ""wink {

?>

<a href="<?= $bottomad2_url?>">

<?

}

?>

<img src="listings/<?= $bottomad2?>" alt="" border="0" />

<?

if ($bottomad2_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

</table></td>

</tr>

</table>

</td>

<td width="160" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5">

<tr>

<td><div align="center">

<?

if ($rightad1_url <> ""wink {

?>

<a href="<?= $rightad1_url?>">

<?

}

?>

<img src="listings/<?= $rightad1?>" alt="" border="0" />

<?

if ($rightad1_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

<tr>

<td><div align="center">

<?

if ($rightad2_url <> ""wink {

?>

<a href="<?= $rightad2_url?>">

<?

}

?>

<img src="listings/<?= $rightad2?>" alt="" border="0" />

<?

if ($rightad2_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

<tr>

<td><div align="center">

<?

if ($rightad3_url <> ""wink {

?>

<a href="<?= $rightad3_url?>">

<?

}

?>

<img src="listings/<?= $rightad3?>" alt="" border="0" />

<?

if ($rightad3_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

<tr>

<td><div align="center">

<?

if ($rightad4_url <> ""wink {

?>

<a href="<?= $rightad4_url?>">

<?

}

?>

<img src="listings/<?= $rightad4?>" alt="" border="0" />

<?

if ($rightad4_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

<tr>

<td><div align="center">

<?

if ($rightad5_url <> ""wink {

?>

<a href="<?= $rightad1_ur5?>">

<?

}

?>

<img src="listings/<?= $rightad5?>" alt="" border="0" />

<?

if ($rightad5_url <> ""wink {

?>

</a>

<?

}

?>

</div></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

<tr>

<td><div align="center">

<?



?>

<a href="<?= $rightad6_url?>">

<?



?>

<img src="listings/<?= $rightad6?>" alt="" border="0" />

<?



?>

</a>

<?



?>

</div></td>

</tr>

<tr>

<td>&nbsp;</td>

</tr>

</table></td>

</tr>

</table>

<table width="700" border="0" align="center" cellpadding="5" cellspacing="0">

<tr>

<td>

<div class="center">

<p class="foot">Note: Dear users, prescribing medications online or giving a diagnosis contradicts







medical ethics, which is why Doctors Online can only offer General information's and advise you on what medical professional to consult.</p>

</div>

</td>

</tr>

</table>

<?

include("footertext.php"wink;

?>

</body>

</html>

(1) (2) (3) (Reply)

Join The Clarion Call: Seun, Add A 'dislike' Button To Every Topic Or Post / Jamb Past Questions API In JSON / Facebook Blocked My Account, Any Help?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 298
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.