jcbones
Staff Alumni-
Posts
2,653 -
Joined
-
Last visited
-
Days Won
8
Everything posted by jcbones
-
No, php doesn't care were you move the file to, just so long as it is a directory with write permissions, and you supply a valid path to it.
-
import csv data into database according to header
jcbones replied to IreneLing's topic in PHP Coding Help
Here is a user supplied function from the php manual page (slightly modified), and it should fit your use. <?php function csv_file_to_mysql_table($source_file, $target_table, $max_line_length=10000) { if (($handle = fopen($source_file, "r")) !== FALSE) { $columns = fgetcsv($handle, $max_line_length, ","); foreach ($columns as &$column) { $column = str_replace(".","",$column); } while (($data = fgetcsv($handle, $max_line_length, ",")) !== FALSE) { while(count($data) < count($columns)) { array_push($data, NULL); } $c = count($data); for($i = 0; $i < $c; $i++) { $data[$i] = "'{$data[$i]}'"; } $sql[] = '(' . implode(',',$data) . ')'; } $query = "INSERT INTO $target_table (".implode(",",$columns).")VALUES " . implode(',',$sql) . "\n"; //mysql_query($query) or trigger_error(mysql_error()); echo $query; fclose($handle); } } $file = 'test.csv'; $table = 'test'; csv_file_to_mysql_table($file,$table); Right now, it just prints to the page to show you what the query will look like, just remove the comment marks on the query line to insert it. -
This is the only thing I can find for you at the moment: What this means is, you must take it up with your host.
-
What is the contents of $category? Just one example will do.
-
You need to make sure there are no spaces before or after your PHP tags, and if the script is UTF-8 encoded, make sure there is no BOM (byte-order-mark) at the beginning of the page. PHP see's all of that as output.
-
Retrieving contents from a page that you're probably not meant to
jcbones replied to manix's topic in PHP Coding Help
Not a legal firm I would trust explicitly. I could go on, and on!!! You can use "limited portions", and you still must CITE them. Using everything and citing them is still illegal. -
401 unauthorized is a HTTP return, so you must be opening the file with a URL. Is this correct? This post could be taken care of faster, if there was code interjected.
-
You need to de-bug the files. error_reporting(-1); ini_set('display_errors',1);
-
Are you opening a file, or a URL? If it is a file, set the file permissions. IF it is a URL, the fopen wrappers may be disabled in the php.ini file
-
Another mysql_affected_rows error on update query
jcbones replied to rick.emmet's topic in PHP Coding Help
mysqli_affected_rows($conn) It needs the connection, not the resource returned by a query. They even have an example in the manual> mysqli_affected_rows() -
range is a MySQL reserved keyword, wrap it in backticks `range`='5000'
-
Before you start storing to much data in the database, you might want to learn about database normalization. you will be glad you did, because it will save a ton of work later.
-
You need a properly coded form with all of the information you wish to collect from the user, and the action set to the processing file. Processing file checks the form parameters to make sure they are what you expect them to be. Sanitizes the inputs so they will contain no database injection. Inserts the data into a NEW database table, linking the comment to the news article by the news articles ID (primary key). Then re-directs back to the news story page, which then calls the comments with a JOIN query, and displays them however you want to.
-
I don't think you are actually being re-directed to the other site, but that it looks that way, because you are echo'ing the contents out to the browser.
-
It can be echo'd, but only if the include is terminated with a return. Source. I've never used it myself, but just know that it is there.
-
Neither of those will work, because in the first one, you are escaping the quote, and the second one, you are escaping the dollar sign. <?php $resizeObj = new resize('C:\xampp\htdocs\images_test\\'. $file); OR <?php $resizeObj = new resize("C:\xampp\htdocs\images_test\\$file"); See the interpreter here actually catches it.
-
I have no idea! I would need to see the script to even began an idea.
-
Help with a php shopping cart assignment (please?)
jcbones replied to glcapam03's topic in PHP Coding Help
You changed to SCRIPT_NAME, did you echo it out to see what it contained? -
Help with a php shopping cart assignment (please?)
jcbones replied to glcapam03's topic in PHP Coding Help
I'll break it down to you then. <?php if($_SERVER['PHP_SELF']!="../cart.php"){ //if this returns true (current page IS NOT equal to ../cart.php) echo "<h1>Cart Contents</h1>"; echo "<div class=\"p2\">"; $qty=0; $itemCount=$qty; foreach($_SESSION['cart'] as $qty){ for($i=0;$i<count(qty);$i++){ $itemCount+=$qty; } } echo "<a href=\"cart.php\">You have ".$itemCount." items in your cart.</a>"; //this will echo. echo "</div>\n"; } Look at the comments. If you fix the if statement to say: only show this info if the page is not equal to the cart script. You fix your problem. I'm trying not to give you the direct answer, rather get you to think about the problem and the solution. Hint (big one). Those two dots (..) are trying to get the better of you. -
Current time isn't displaying the correct hour.
jcbones replied to D.Rattansingh's topic in PHP Coding Help
To repeat, your timezone setting is off, you can fix it by date_default_timezone_set. functions: Runtime date_default_timezone_set EX. date_default_timezone_set('America/New_York'); ini_set EX ini_set('date.timezone','America/New_York'); OR, it can be set in the php.ini. -
PHP Help with multiple choice for search page (mySQL)
jcbones replied to WebsiteDesigner's topic in PHP Coding Help
Please put all future code inside of tags, it will help keep the thread cleaner. This script has no parse errors, I have included what I wrote into the appropriate place. You could also insert it into the top search as well. <?php include('includes/db.php'); include('includes/functions.php'); function distance($lat1, $lon1, $lat2, $lon2, $unit) { $theta = $lon1 - $lon2; $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); $dist = acos($dist); $dist = rad2deg($dist); $miles = $dist * 60 * 1.1515; $unit = strtoupper($unit); if ($unit == "K") { return ($miles * 1.609344); } else if ($unit == "N") { return ($miles * 0.8684); } else { return $miles; } } ?> <!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" dir="ltr" lang="en-US"> <head profile="http://gmpg.org/xfn/11"> <title></title> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <link rel="shortcut icon" href="images/favicon.ico" /> <link rel="stylesheet" type="text/css" href="css/stylesheet.css" media="screen" /> <link rel="stylesheet" type="text/css" href="css/coin-slider-styles.css" /> <link rel="stylesheet" type="text/css" href="css/menusm.css" /> <link rel="stylesheet" type="text/css" href="css/superfish.css" media="screen" /> <link rel="stylesheet" href="css/pagenavi-css.css" type="text/css" media="screen" /> <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="js/menusm.js"></script> <script type="text/javascript" src="js/coin-slider.min.js"></script> <script type="text/javascript" src="js/hoverintent.js"></script> <script type="text/javascript" src="js/superfish.js"></script> <link rel="stylesheet" href="css/pagenavi-css.css" type="text/css" media="screen" /> <script type="text/javascript" src="js/fancybox/jquery.min.js"></script> <script> !window.jQuery && document.write('<script src="js/fancybox/jquery-1.4.3.min.js"><\/script>'); </script> <script type="text/javascript" src="js/fancybox/jquery.mousewheel-3.0.4.pack.js"></script> <script type="text/javascript" src="js/fancybox/jquery.fancybox-1.3.4.pack.js"></script> <link rel="stylesheet" type="text/css" href="js/fancybox/jquery.fancybox-1.3.4.css" media="screen" /> <link rel="stylesheet" href="css/fancystyle.css" /> <script type="text/javascript"> $(document).ready(function() { $("a#example").fancybox(); }); </script> </head> <body> <div id="page"> <?php include('header.php'); ?> <div id="columns"><div class="header_left"> <?php include('menu.php'); ?></div><h2 style="padding-top:200px;padding-left:280px;">Please See Your Search Results Below</h2> <div class="clr"></div> <div id="centercol" style="width:700px;"><div class="box post" id="post-41"> <div class="content"> <div class="clr"></div> <div class="post-excerpt"> <?php if(isset($_GET['latt']) && isset($_GET['long'])) { if($_GET['miles']=="Choose miles option...") { $condition="SELECT ( 3959 * acos( cos( radians( '".$_GET['latt']."' ) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians( '".$_GET['long']."' ) ) + sin( radians( '".$_GET['latt']."' ) ) * sin( radians( latitude ) ) ) ) as distance,id,membership FROM notary_members "; if(!empty($_GET['s'])) { $a=" where and"; } else { $a=" where"; } if($_GET['edoc']!='') { $condition.=$a." edoc= 'yes'"; } if($_GET['esign']!='') { if($_GET['edoc']!='') $condition.=" and esign= 'yes'"; else $condition.=$a." esign= 'yes'"; } if($_GET['laserprinter']!='') { if($_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and laserprinter= 'yes'"; else $condition.=" laserprinter= 'yes'"; } if($_GET['dualtray']!='') { if( $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and dualtray= 'yes'"; else $condition.=" dualtray= 'yes'"; } if($_GET['error_in']!='') { if($_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and error_in= 'yes'"; else $condition.=" error_in= 'yes'"; } if($_GET['bg_checked']!='') { if($_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and bg_checked= 'yes'"; else $condition.=" bg_checked= 'yes'"; } if($_GET['home_insp']!='') { if($_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and home_insp= 'yes'"; else $condition.=" home_insp= 'yes'"; } if($_GET['fingerprint']!='') { if($_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and fingerprint= 'yes'"; else $condition.=" fingerprint= 'yes'"; } if($_GET['hosp_signing']!='') { if($_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and hosp_signing= 'yes'"; else $condition.=" hosp_signing= 'yes'"; } if($_GET['jail_signing']!='') { if($_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and jail_signing= 'yes'"; else $condition.=" jail_signing= 'yes'"; } if($_GET['im_docs']!='') { if($_GET['jail_signing']!='' || $_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='') $condition.=" and im_docs= 'yes'"; else $condition.=" im_docs= 'yes'"; } if($_GET['jail_signing']!='' || $_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='' || $_GET['im_docs']!='') { $condition.=" and status=1 order by distance asc"; } else { $condition.=$a." status=1 order by distance asc"; } $sql=mysql_query($condition); $num=mysql_num_rows($sql); $c=0; while($getidres=mysql_fetch_array($sql)) { if($getidres['distance']<=30) { if($getidres['membership']=='premium') { $prefirst[$getidres['id']]=$getidres['distance']; $c++; } else { $basicfirst[$getidres['id']]=$getidres['distance']; $c++; } } } if(!empty($sql)) { if($c!=0) { if(!empty($prefirst) || !empty($basicfirst)) { ?> <table border="0" cellpadding="0" cellspacing="0" style="background-color:#D4A017;height:20px;" width="1000px"> <tr> <td width="300px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;"> Name</td> <td width="200px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">Company Name</td> <td width="300px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">City, State and Zip Code</td> <td width="100px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">Profile</td> <td width="100px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;font-variant:small-caps;">Estimated Miles</td> </tr></table> <?php } if(!empty($prefirst)) { ?> <table> <table border="0" cellpadding="0" cellspacing="0" style="background-color:#1b76ff;color:#fff;height:20px;" width="1000px"> <tr> <td colspan="3" style="margin-left:10px;text-align:left;font-weight:bold;padding:10px 10px;">Premium Members</td> </tr></table> <tr><td> </td></tr> </table> <?php foreach($prefirst as $key=>$value) { $sql=mysql_query("SELECT * FROM notary_members WHERE id='".$key."'"); $data=mysql_fetch_object($sql); ?> <table border="0" cellpadding="0" cellspacing="0" width="1000px"> <tr onMouseOver="this.style.backgroundColor='#E1EAFE'"; onMouseOut="this.style.backgroundColor='transparent'"> <td width="300" style="text-align:left; height:28px;"> <img src="images/75px-Blue_check_plus.svg.png" width="20" height="15" align="left" style="padding-right:10px;" /> <a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;"> <?php echo $data->firstname." ".$data->lastname; ?> </a></td> <td width="235" style="text-align:left; height:28px;"> <a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;"> <?php if(!empty($data->bname)) { echo $data->bname; } ?> </a></td> <td width="243" style="text-align:left; height:28px;"> <a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;"> <?php echo $data->city." ".$data->state." ".$data->zipcode;?></a></td> <td width="112" style="text-align:left;font-weight:bold; height:28px;"> <a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;">» Profile </a></td> <td width="110" style="text-align:left;font-weight:bold; height:28px;"> <?php echo round($value, 2)." Miles";?></td> </tr></table> <?php } } if(!empty($basicfirst)) { ?> <table><tr><td> </td></tr></table> <table border="0" cellpadding="0" cellspacing="0" style="background-color:#808080;color:#fff;height:20px;" width="1000px"> <tr> <td colspan="3" style="margin-left:10px;text-align:left;font-weight:bold;padding:2px 10px;">Basic Members</td> </tr></table> <tr><td> </td></tr> </table> <?php foreach($basicfirst as $key=>$value) { $sql=mysql_query("SELECT * FROM notary_members WHERE id='".$key."'"); $data=mysql_fetch_object($sql); ?> <table border="0" cellpadding="0" cellspacing="0" width="1000px"> <tr onMouseOver="this.style.backgroundColor='#E1EAFE'"; onMouseOut="this.style.backgroundColor='transparent'"> <td width="300" style="text-align:left;height:28px;"> <a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal; margin-left:28px;"> <?php echo $data->firstname." ".$data->lastname; ?> </a></td> <td width="237" style="text-align:left;height:28px; "> <a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;"> <?php if(!empty($data->bname)) { echo $data->bname; } ?> </a></td> <td width="241" style="text-align:left;height:28px;"> <a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;"> <?php echo $data->city." ".$data->state." ".$data->zipcode;?></a></td> <td width="112" style="text-align:left;font-weight:bold;height:28px;"> <a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;">» Profile </a></td> <td width="110" style="text-align:left;height:28px;"> <?php echo round($value, 2)." Miles";?></td> </tr></table> <?php } } } else { ?> <div align="center" style="color:#353635;">We are sorry. There are no registered Notary Publics in the area you have selected. You can choose to start a new search <a href="advancedsearch.php" style="text-decoration:none;">(Advanced Search)</a> or <a href="email.php" style="text-decoration:none;">email us here</a>.</br> </br> If you are a Notary Public and wish to advertise your services, simply click on the following link: <a href="membership.php" style="text-decoration:none;">Sign-up</a>. </div> <?php } } else { ?> <div align="center" style="color:#353635;">We are sorry. There are no registered Notary Publics in the area you have selected. You can choose to start a new search <a href="advancedsearch.php" style="text-decoration:none;">(Advanced Search)</a> or <a href="email.php" style="text-decoration:none;">email us here</a>.</br> </br> If you are a Notary Public and wish to advertise your services, simply click on the following link: <a href="membership.php" style="text-decoration:none;">Sign-up</a>. </div> <?php } ?> <?php } else{ if(!empty($_GET['latt']) && !empty($_GET['long'])) { $condition="SELECT ( 3959 * acos( cos( radians( '".$_GET['latt']."' ) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians( '".$_GET['long']."' ) ) + sin( radians( '".$_GET['latt']."' ) ) * sin( radians( latitude ) ) ) ) as distance,id,membership FROM notary_members "; //declare an array, this will hold our columns if they are in the search params. $queryCon = array(); //set the columns to an array ONLY if they exist in our search params. if(!empty($_GET['edoc'])) { $queryCon[] = 'edoc=\'yes\''; } if(!empty($_GET['esign'])) { $queryCon[] ="esign= 'yes'"; } if(!empty($_GET['laserprinter'])) { $queryCon[] ="laserprinter= 'yes'"; } if(!empty($_GET['dualtray'])) { $queryCon[] ="dualtray= 'yes'"; } if(!empty($_GET['error_in'])) { $queryCon[] ="error_in= 'yes'"; } if(!empty($_GET['bg_checked'])) { $queryCon[] ="bg_checked= 'yes'"; } if(!empty($_GET['home_insp'])) { $queryCon[] ="home_insp= 'yes'"; } if(!empty($_GET['fingerprint'])) { $queryCon[] ="fingerprint= 'yes'"; } if(!empty($_GET['hosp_signing'])) { $queryCon[] ="hosp_signing= 'yes'"; } if(!empty($_GET['jail_signing'])) { $queryCon[] ="jail_signing= 'yes'"; } if(!empty($_GET['im_docs'])) { $queryCon[] ="im_docs= 'yes'"; } //since you have a constant column called status, then make your WHERE. $condition .= ' WHERE '; //if the array isn't empty (search params exist ) then implode the columns. if(!empty($queryCon)) { $condition .= implode(' AND ',$queryCon) . ' AND '; } //set the last part of the query, which would be the status column, and order by. $condition .= 'status = 1 ORDER BY distance ASC'; $sql=mysql_query($condition); $num=mysql_num_rows($sql); $getmile=explode(' ',$_GET['miles']); $c=0; while($getidres=mysql_fetch_array($sql)) { if($getidres['distance']<=$getmile[0]) { if($getidres['membership']=='premium') { $prefirst[$getidres['id']]=$getidres['distance']; $c++; } else { $basicfirst[$getidres['id']]=$getidres['distance']; $c++; } } } if(!empty($sql)) { if($c!=0) { if(!empty($prefirst) || !empty($basicfirst)) { ?> <table border="0" cellpadding="0" cellspacing="0" style="background-color:#D4A017;height:20px;" width="1000px"> <tr> <td width="300px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">Notary Public Name</td> <td width="200px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">Company Name</td> <td width="300px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">City, State and Zip Code</td> <td width="100px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;font-variant:small-caps;">Profile</td> <td width="100px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;font-variant:small-caps;">Estimated Miles</td> </tr></table> <?php } if(!empty($prefirst)) { ?> <table> <table border="0" cellpadding="0" cellspacing="0" style="background-color:#1b76ff;color:#fff;height:20px;" width="1000px"> <tr> <td colspan="3" style="margin-left:10px;text-align:left;font-weight:bold;padding:10px 10px;">Premium Members</td> </tr></table> <tr><td> </td></tr> </table> <?php foreach($prefirst as $key=>$value) { $sql=mysql_query("SELECT * FROM notary_members WHERE id='".$key."'"); $data=mysql_fetch_object($sql); ?> <table border="0" cellpadding="0" cellspacing="0" width="1000px"> <tr> <td width="300" style="text-align:left; height:28px;"> <img src="images/75px-Blue_check_plus.svg.png" width="20" height="15" align="left" style="padding-right:10px;" /> <a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;"> <?php echo $data->firstname." ".$data->lastname; ?> </a></td> <td width="231" style="text-align:left; height:28px;"> <a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;"> <?php if(!empty($data->bname)) { echo $data->bname; } ?> </a></td> <td width="247" style="text-align:left; height:28px;"> <a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;"> <?php echo $data->city." ".$data->state." ".$data->zipcode;?></a></td> <td width="112" style="text-align:left;font-weight:bold; height:28px;"> <a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;"> » Profile </a></td> <td width="110" style="text-align:left;font-weight:bold; height:28px;"> <?php echo round($value, 2)." Miles";?></td> </tr></table> <?php } } if(!empty($basicfirst)) { ?> <table><tr><td> </td></tr></table> <table border="0" cellpadding="0" cellspacing="0" style="background-color:#808080;color:#fff;height:20px;" width="1000px"> <tr> <td colspan="3" style="margin-left:10px;text-align:left;font-weight:bold;padding:2px 10px;">Basic Members</td> </tr></table> <tr><td> </td></tr> </table> <?php foreach($basicfirst as $key=>$value) { $sql=mysql_query("SELECT * FROM notary_members WHERE id='".$key."'"); $data=mysql_fetch_object($sql); ?> <table border="0" cellpadding="0" cellspacing="0" width="1000px"> <tr> <td width="293" style="text-align:left;border-right:solid 1px #fff; height:28px; "> <a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal; margin-left:28px;"> <?php echo $data->firstname." ".$data->lastname; ?></a></td> <td width="239" style="text-align:left;border-right:solid 1px #fff; height:28px;"><?php if(!empty($data->bname)) { echo $data->bname; } ?></td> <td width="227" style="text-align:left;border-right:solid 1px #fff; height:28px;"> <?php echo $data->city." ".$data->state." ".$data->zipcode;?></td> <td width="21"></td> <td width="110" style="text-align:left;font-weight:bold; height:28px;"><a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;">» Profile </a></td> <td width="110" style="text-align:left; height:28px;"> <?php echo round($value, 2)." Miles";?></td> </tr></table> <?php } } } else { ?> <div align="center" style="color:#353635;">We are sorry. There are no registered Notary Publics in the area you have selected. You can choose to start a new search <a href="advancedsearch.php" style="text-decoration:none;">(Advanced Search)</a> or <a href="email.php" style="text-decoration:none;">email us here</a>.</br> </br> If you are a Notary Public and wish to advertise your services, simply click on the following link: <a href="membership.php" style="text-decoration:none;">Sign-up</a>. </div> <?php } } }else {?> <div align="center" style="color:#353635;">We are sorry. There are no registered Notary Publics in the area you have selected. You can choose to start a new search <a href="advancedsearch.php" style="text-decoration:none;">(Advanced Search)</a> or <a href="email.php" style="text-decoration:none;">email us here</a>.</br> </br> If you are a Notary Public and wish to advertise your services, simply click on the following link: <a href="membership.php" style="text-decoration:none;">Sign-up</a>. </div> <?php } } } ?> </div> </div></div> <div class="clr"></div> </div> <div class="clr"></div></div> <div class="clr"></div></div> <?php include('footer.php'); ?><div class="clr"></div> </div></body></html> -
Help with a php shopping cart assignment (please?)
jcbones replied to glcapam03's topic in PHP Coding Help
This $_SERVER variable will not return a relative file path such as ../anything. Rather, it returns the full path back to the document or web root. To try it out, just echo it out. <?php echo $_SERVER['PHP_SELF']; ?> -
PHP Help with multiple choice for search page (mySQL)
jcbones replied to WebsiteDesigner's topic in PHP Coding Help
Since you posted a code snippet, and all of my brackets line up, I cannot tell where the error lies. I do know that you cut the snippet inside of some brackets, make sure you have closing brackets for every opening one. -
To further clarify requinix, You limit the rows from a database with a LIMIT clause in the query. SELECT * FROM table LIMIT 10 <-returns first 10 rows. SELECT * FROM table LIMIT 10,10 <- starts rows at row 10, returns 10 rows.
-
Help with a php shopping cart assignment (please?)
jcbones replied to glcapam03's topic in PHP Coding Help
If you echo out $_SERVER['PHP_SELF'] you will find that it would never, EVER contain that string. You can restrict the string based on the file name, just not with the string you are comparing to.