if else problem, help please


Posted on 16th Feb 2014 07:03 pm by admin

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 have it work as i intended.

Code: [Select]<!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" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
</head>

<body>
<?php
echo '<link href="path/custom/style.css" rel="stylesheet" type="text/css">';

$model = $_GET['id'];
$filename = (explode (":",$model));
$filename2 = (explode ("-",$filename[1]));
$space = " ";
$path = $filename2[0]. $space . $filename2[1];

$user_name = "";
$password = "";
$database = "";
$server = "";



$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);

$model = "SELECT * FROM ..... WHERE name='$path'";

$result = mysql_query($model);

while($rows=mysql_fetch_array($result)){

if ($rows['name'] == $path){
?></p>
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="profile">
<tr>
<td width="25%" height="113" valign="top"><table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td width="27%" bgcolor="#8DCEFA">Model</td>
<td width="5%" bgcolor="#003464"><div align="center"><span class="style1">:</span></div></td>
<td width="68%" bgcolor="#FAE4AB"><? echo $rows['name']?></td>
</tr>
<tr>
<td bgcolor="#8DCEFA">Age:</td>
<td bgcolor="#003464"><div align="center"><span class="style1">:</span></div></td>
<td bgcolor="#FAE4AB"><? echo $rows['age'] ?></td>
</tr>
<tr>
<td bgcolor="#8DCEFA">Country</td>
<td bgcolor="#003464"><div align="center"><span class="style1">:</span></div></td>
<td bgcolor="#FAE4AB"><? echo $rows['country'] ?></td>
</tr>
<tr>
<td bgcolor="#8DCEFA">City</td>
<td bgcolor="#003464"><div align="center"><span class="style1">:</span></div></td>
<td bgcolor="#FAE4AB"><? echo $rows['city'] ?></td>
</tr>
<tr>
<td bgcolor="#8DCEFA">Ethnic</td>
<td bgcolor="#003464"><div align="center"><span class="style1">:</span></div></td>
<td bgcolor="#FAE4AB"><? echo $rows['ethnic'] ?></td>
</tr>
</table></td>
<td width="19%" valign="top"><table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td width="66" bgcolor="#8DCEFA">Eyes</td>
<td width="12" bgcolor="#003464"><div align="center"><span class="style1">:</span></div></td>
<td width="99" bgcolor="#FAE4AB"><? echo $rows['eyes'] ?></td>
</tr>
<tr>
<td bgcolor="#8DCEFA">Hair</td>
<td bgcolor="#003464"><div align="center"><span class="style1">:</span></div></td>
<td bgcolor="#FAE4AB"><? echo $rows['hair'] ?></td>
</tr>
<tr>
<td bgcolor="#8DCEFA">Height</td>
<td bgcolor="#003464"><div align="center"><span class="style1">:</span></div></td>
<td bgcolor="#FAE4AB"><? echo $rows['height'] ?></td>
</tr>
<tr>
<td bgcolor="#8DCEFA">Weight</td>
<td bgcolor="#003464"><div align="center"><span class="style1">:</span></div></td>
<td bgcolor="#FAE4AB"><? echo $rows['weight'] ?></td>
</tr>
<tr>
<td width="66" bgcolor="#8DCEFA">style</td>
<td bgcolor="#003464"><div align="center"><span class="style1">:</span></div></td>
<td bgcolor="#FAE4AB"><? echo $rows['style'] ?></td>
</tr>
</table></td>
<td width="56%" valign="top"><table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td bgcolor="#8DCEFA">Biography</td>
</tr>
<tr>
<td bgcolor="#FAE4AB"><? echo $rows['bio'] ?></td>
</tr>
</table></td>
</tr>
</table>

<?
}else {

echo "it works";
}
}
mysql_close($db_handle);
?>
</p>
</body>
</html>

maybe sone help me figure out what i did wrong here

No comments posted yet

Your Answer:

Login to answer
57 Like 9 Dislike
Previous forums Next forums
Other forums

Downloading file (Headers)
I'm trying to make users download a file, but they must wait 60 seconds before it begins.

But

pop3 and fsockopen
So I am able to connect to the pop3 server, log in, and check how many messages there are. I am hav

Problem with PHP/mySQL login code
Hello,

There is an error in my login script and I can't figure out what it is...
I believe

Storing the referrer in session... problems with tabs
Hello All

I am currently working on an ERP project based on the MVC methodology, when a user

Varible in trigger - refering to correct schema
Hello

Im having some issues with my trigger.
What I want to do is call opon a differ

INSERT for date range
Hi all

I have the following table

Code: [Select] `date` date
`day` int(2)
`

Help? Need help on project with templates involving mysql and php.
I'm having a hard time explaining what I want but basically here is what I have in place:

-Da

rename the file
File.txt

Code: ***DOCUMENT***
..DN:
000044255
..CB:
..SN:
..PY:
2009
..E

Need a Timecode Class...
Not a Time Stamp, Time Code. Format is a bit different. HH:MM:SS:FF where FF is Frames. I dont re

retrieving more than one max key from an array?
so i have an array of 20 numerical values (0-100) that i need to order from highest to lowest and th

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash