PHP - Executes Database Query When The Page Is Loaded
Good evening,
I am currently doing a web application which requires pulling out of data from the database. I am still a novice in the programming industry, and is still seeking help from my colleagues and of course forum sites like phpdn. I have an existing code which my friend provided me. I have already done some modifications with the code. I have a problem though with the code, it executes database query upon loading of the page. I do understand how the code works, however, I am not able to modify the code to disallow the execution of query upon loading of page. Here is the code: <?PHP include("dbconnection.php"); $query = "SELECT * FROM records"; if(isset($_POST["btnSearch"])) { $query .= " WHERE last_name LIKE '%".$_POST["search"]."%' OR first_name LIKE '%".$_POST["search"]."%'OR territory LIKE '%".$_POST["search"]."%'OR job_title LIKE '%".$_POST["search"]."%'OR title LIKE '%".$_POST["search"]."%'OR employer LIKE '%".$_POST["search"]."%' " ; } $result = mysql_query($query, $connection) or die(mysql_error()); ?> I do know that this php code, the way it is written, is supposed to do that - to select data from my database (This code was provided by a friend). But my requirement for the project is actually to give it a search engine and display the information based from the search query. I have a search engine already together with the code, and it works pretty well. What I must do is to disallow the pulling of data from the first load, but just pull data if the search engine is used. Here's the whole code: <link href="add_client.css" rel="stylesheet" type="text/css"> <?PHP include("dbconnection.php"); $query = "SELECT * FROM records"; if(isset($_POST["btnSearch"])) { $query .= " WHERE last_name LIKE '%".$_POST["search"]."%' OR first_name LIKE '%".$_POST["search"]."%'OR territory LIKE '%".$_POST["search"]."%'OR job_title LIKE '%".$_POST["search"]."%'OR title LIKE '%".$_POST["search"]."%'OR employer LIKE '%".$_POST["search"]."%' " ; } $result = mysql_query($query, $connection) or die(mysql_error()); ?> <table width="760" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><table width="760" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="199" align="center" valign="top"><a href="login.html"><img src="asia.gif" alt="" width="152" height="58" border="0" /></a> <script type="text/javascript" src="menu.js"></script></td> <td width="176" align="right" valign="bottom"><a href="main.php"><img src="Home.jpg" width="104" height="20" border="0"/></a></td> <td width="130" align="right" valign="bottom"><img src="View.jpg" width="104" height="20" border="0"/></td> <td width="146" align="right" valign="bottom"><a href="add_client.php"><img src="Add.jpg" width="104" height="20" border="0"/></a></td> <td width="109" align="right" valign="bottom"> </td> </tr> </table></td> </tr> <tr> <td><table width="760" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="200" height="3" bgcolor="#1B1C78"><img src="images/topspacerblue.gif" alt="" width="1" height="3" /></td> <td width="560" bgcolor="#0076CC"><img src="images/topspacerlblue.gif" alt="" width="1" height="3" /></td> </tr> </table></td> </tr> <tr> <td height="553" align="center" valign="top" bgcolor="#F3FAFE"><br /> <form name="form" action="view_client.php" method="post"> <table width="351" border="0"> <tr> <td width="137" align="left" valign="middle">SEARCH RECORD:</td> <td width="144" align="center" valign="middle"><input type="text" name="search" /></td> <td width="56" align="left" valign="middle"><input type="submit" name="btnSearch" value="Search" /></td> </tr> </table> <br /> <table width="680" border="0" cellpadding="3" cellspacing="1" bordercolor="38619E" > <tr> <th width="100" align="center" bgcolor="#E0E8F3">Territory</th> <th width="110" align="center" bgcolor="#E0E8F3">Employer</th> <th width="110" align="center" bgcolor="#E0E8F3">Job Title</th> <th width="50" align="center" bgcolor="#E0E8F3">Title</th> <th width="110" align="center" bgcolor="#E0E8F3">First Name</th> <th width="110" align="center" bgcolor="#E0E8F3">Last Name</th> <th width="70" align="center" valign="middle" bgcolor="#E0E8F3"> </th> </tr> <?php if($result) { for($i=0; $i<mysql_num_rows($result); $i++) { $id = trim(mysql_result($result, $i, "id")); $territory = trim(mysql_result($result, $i, "territory")); $employer = trim(mysql_result($result, $i, "employer")); $job_title = trim(mysql_result($result, $i, "job_title")); $title = trim(mysql_result($result, $i, "title")); $first_name = trim(mysql_result($result, $i, "first_name")); $last_name = trim(mysql_result($result, $i, "last_name")); echo "<tr>"; echo "<td>".$territory."</td>"; echo "<td>".$employer."</td>"; echo "<td>".$job_title."</td>"; echo "<td>".$title."</td>"; echo "<td>".$first_name."</td>"; echo "<td>".$last_name."</td>"; echo "<td><a href='admin_edit.php?id=".$id."'>edit</a> | <a href='admin_delete.php?id=".$id."'>del</a> </td>"; echo "</tr>"; } } ?> </table> <br /> </form> <p> </p></td> </tr> <tr> <td height="38"><table width="760" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="200" height="35" align="center" bgcolor="#1B1C78" class=white><img src="images/topspacerblue.gif" alt="" width="1" height="3" /> <a href="disclaimer.html"><font color="#FFFFFF">Legal Disclaimer</font></a> </td> <td width="560" align="center" bgcolor="#0076CC" class=white><img src="images/topspacerlblue.gif" alt="" width="1" height="3" /> Copyright © 2006 - 2010 Limited. All rights reserved. </td> </tr> </table></td> </tr> </table> Immediate response is well appreciated. Thank you very much! Similar TutorialsI'm restarting this under a new subject b/c I learned some things after I initially posted and the subject heading is no longer accurate. What would cause this behavior - when I populate session vars from a MYSQL query, they stick, if I populate them from an MSSQL query, they drop. It doesn't matter if I get to the next page using a header redirect or a form submit. I have two session vars I'm loading from a MYSQL query and they remain, the two loaded from MSSQL disappear. I have confirmed that all four session vars are loading ok initially and I can echo them out to the page, but when the application moves to next page via redirect or form submit, the two vars loaded from MSSQL are empty. Any ideas? Hi, I have a sql query that executes perfectly in phpMyAdmin but when applied to a PHP script returns nothing. It won't even start a "while" loop. Please review code snippits below. Submission Script calls function in Database Class: $result = $database->testReturnId($_POST['years'], $_POST['model']); while($row = mysql_fetch_array($result)) { $i = $i + 1; echo "ROW " . $i . " " . $row['auto_id'] . " " . $row['auto_year'] . " " . $row['auto_year_high'] . " " . $row['auto_make'] . " " . $row['auto_model'] . "<br />"; } Database Class Function: function testReturnId($year, $model){ global $form; $q = 'SELECT * FROM tbl_svc_auto WHERE auto_model = "$model" AND "$year" BETWEEN auto_year AND auto_year_high'; if(!mysql_query($q, $this->connection)){ return false; }else{ return $result = mysql_query($q, $this->connection); } } I have moved the query to the submission script and replaced the variables with actual data and it still will not work. I can take the same query with out the variables and input it into phpMyAdmin and it works great. On the submission script, I added a row number to the echo thinking that it would a least return the word "ROW" and it does not. I have tested each step of the execution of the query and have not returned any errors. I do not receive any errors at all even during execution. It just seems to refuse to run the "while" statement. I do not know where my problem is......Please help. Thank you in advance for any assitance you can offer. Joshua Hello i am trying to make the admin login in a webpage and after I completed the page i uploaded it and now the page is not loading
Here is the script
<?php error_reporting(E_ALL); ini_set('display_errors', '1'); exit(); ?> <?php session_start(); if (!isset($_SESSION["manager"])){ header("location:admin_login.php"); exit(); } exit(); ?> <?php if(isset($_POST["username"])&&isset($_POST["password"])){ $manager=preg_replace('#[^A-Za-z0-9]#i','',$_POST["username"]); $password=preg_replace('#[^A-Za-z0-9]#i','',$_POST["password"]); include"../storescripts/connect_to_mysql.php"; $sql=mysql_querey("SELECT id FROM admin WHERE username='$manager' AND password='$password' LIMIT 1"); if($existCount == 1){ while($row = mysql_fetch_array($sql)){ $id = $rpw["id"]; } $_SESSION["id"] = $id; $_SESSION["manager"] = $manager; $_SESSION["password"] = $password; header("location:index.php"); exit(); } else { echo 'That Information is incorrect, try again <a href="index.php">Click Here</a>'; exit(); } } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Admin Login</title> <link rel="stylesheet" href="k../style/style.css" type="text/css" media=="screen" /> <script type="text/javascript" src="//use.typekit.net/jxp6vds.js"></script> <script type="text/javascript">try{Typekit.load();}catch(e){}</script> </head> <body> <div align="centre" id="mainWrapper"> <?php include_once("../template_header.php") ?> <div id="pageConntent"> <h2>Please Log In To Manage The store</h2> <form id="form1" name="form1" meathod="post" action="admin_login.php"> Username:<br/> <input name="username" type="text" id="username" size="40"/> <br/><br/> Password<br/> <input name="password" type="password" id="password" size="40"/> <br/> <br/> <br/> <input type="submit" name="button" id="button" value="Log In" /> </form> </div> <?php include_once("../footer.php"); ?> </div> </body> </html>Thank you in advance Ok, just another noob problem here while working with PHP + MySQL: I have a php page containing a form which I use to pull the data from mysql database. When the user chooses a value/values from the dropdown lists and clicks submit, the page reloads and displaying the quarry results according to user's selection. When user first loads the php page with form, it shows no data unless he clicks submit. Question: How to show a default quarry value on first page load before user even get to use the form? In other words, I want the user to see the default quarry data pulled from DB on page load before he uses the form to refine the results... I am not sure if its possible, but truly hope so I would appreciate any advice or pointer in the right direction. Please let me know if you need the exact code I am using for my form page. when the user clicks the submit button from a html form, it needs to go back two pages with that loaded page refreshed. for the javascript i only have history.go(-2); with php, I have tried cookies and sessions which i discovered that neither will work because the loaded page is not refreshed. I could do a html body onload but that would break the w3c validator. what are my options?
hello I want query from one table and insert in another table on another domain . each database on one domain name. for example http://www.site.com $con1 and http://www.site1.com $con. can anyone help me? my code is : <?php $dbuser1 = "insert in this database"; $dbpass1 = "insert in this database"; $dbhost1 = "localhost"; $dbname1 = "insert in this database"; // Connecting, selecting database $con1 = mysql_connect($dbhost1, $dbuser1, $dbpass1) or die('Could not connect: ' . mysql_error()); mysql_select_db($dbname1) or die('Could not select database'); $dbuser = "query from this database"; $dbpass = "query from this database"; $dbhost = "localhost"; $dbname = "query from this database"; // Connecting, selecting database $con = mysql_connect($dbhost, $dbuser, $dbpass) or die('Could not connect: ' . mysql_error()); mysql_select_db($dbname) or die('Could not select database'); //query from database $query = mysql_query("SELECT * FROM `second_content` WHERE CHANGED =0 limit 0,1"); while($row=mysql_fetch_array($query)){ $result=$row[0]; $text=$row[1]."</br>Size:(".$row[4].")"; $alias=$row[2]; $link = '<a target="_blank" href='.$row[3].'>Download</a>'; echo $result; } //insert into database mysql_query("SET NAMES 'utf8'", $con1); $query3= " INSERT INTO `jos_content` (`id`, `title`, `alias`, `) VALUES (NULL, '".$result."', '".$alias."', '')"; if (!mysql_query($query3,$con1)) { die('Error: text add' . mysql_error()); } mysql_close($con); mysql_close($con1); ?> The following code does what I want it to, but after it's done doing it, it won't stop loading. I believe it is because of the while loops (while(1) { ... } and while($data = ...) { ... }). I need while($data = ...) to read the data from the fsockopen. Thanks in advance function ircConnect($server, $port, $channel, $nick, $pass, $name, $msg) { set_time_limit(15); //If we put set_time_limit(0), the page won't timeout and never stops loading (The script works, that I'm aware of) $fp = fsockopen($server, $port); if(!$fp) die($php_errormsg); if(empty($php_errormsg)) { $error = "None!"; } else { $error = $php_errormsg; } echo "<table border='1' bordercolor='#FFCC00' style='background-color:#FFFFCC' width='400' cellpadding='3' cellspacing='3'>"; echo "<tr><td>Server</td><td>Port</td><td>Channel</td><td>Nick</td><td>Password</td><td>Error</td></tr>"; echo "<tr><td>$server</td><td>$port</td><td>$channel</td><td>$nick</td><td>$pass</td><td>$error</td></tr>"; echo "</table>"; fputs($fp, "USER aBot testchan.org TestchanIRCBot :TheBot\n"); fputs($fp, "PASS $pass\n"); fputs($fp, "NICK $nick\n"); fputs($fp, "JOIN $channel\n"); fputs($fp, "PRIVMSG $channel :$msg, my name is $nick!\n"); while($data = fgets($fp, 128)) { $ex = explode(' ', $data); echo nl2br($data); flush(); if($ex[0] == "PING") fputs($fp, "PONG " . $ex[1] ."\n"); } } http://i.imgur.com/E6j79.jpg Hi I've been working on a site for 6 months and have used the header command to redirect loads and loads of times. But i just noticed some crazy behaviour today. Heres a test page: <?php include("includes/db_connect.php"); header('location:stores.php'); $sql = "insert into test (id) values (77)"; $result = mysql_query($sql); ?> when i hit this page, i get redirected to stores.php, but the sql gets executed! Is this supposed to be the behaviour? Have i completely missed the point of header(location:)?? Im baffled as i've used this before, but only now noticed this crazy behaviour! I have a standard form that displays users current data from a mysql database once logged in(code obtained from the internet). Users can then edit their data then submit it to page called editform.php that does the update. All works well except that the page does not display the updated info. Users have to first logout and login again to see the updated info. even refreshing the page does not show the new info. Please tell me where the problem is as i am new to php.
my form page test.php
<?PHP require_once("./include/membersite_config.php"); if(!$fgmembersite->CheckLogin()) { $fgmembersite->RedirectToURL("login.php"); exit; } ?> <form action="editform.php?id_user=<?= $fgmembersite->UserId() ?>" method="POST"> <input type="hidden" name="id_user" value="<?= $fgmembersite->UserId() ?>"><br> Name:<br> <input type="text" name="name" size="40" value="<?= $fgmembersite->UserFullName() ?>"><br><br> Email:<br> <input type="text" name="email" size="40" value="<?= $fgmembersite->UserEmail() ?> "><br><br> Address:<br> <input type="text" name="address" size="40" value="<?= $fgmembersite->UserAddress() ?> "><br><br> <button>Submit</button>my editform.php <?php $con = mysqli_connect("localhost","root","user","pass"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } mysqli_query($con,"UPDATE fgusers3 SET name = '".$_POST['name']."', email= '".$_POST['email']."', address= '".$_POST['address']."' WHERE id_user='".$_POST['id_user']."'"); header("Location: test.php"); ?> Hello All, Trying to write a log-in script using PDO. But have one question. With the below when I query the database and even run a print_r on $RES nothing is outputted? Any ideas? Thanks if (isset($_POST['Submit'])) { $email = $_POST['email']; $password = $_POST['password']; $QUERY = $dbc->prepare("SELECT email, password FROM tbl WHERE email = :email"); $QUERY->bindParam(':email', $email); $QUERY->execute(); $RES = $QUERY->fetchColumn(); echo "Email is:".$RES['email']; echo "PW is: ".$RES['password']; print_r($RES); } I just did a massive hardware/software upgrade - first new computer (a Mac) in 6 1/2 years, first MAMP upgrade in several years, etc. I'm now using these software versions: Apache 2.2.21, PHP 5.3.6, MySQL 5.5.9 Just about everything seems to be working fine except my database connections. I appear to be making a simple mistake, but I can't figure out the solution. I've checked out all sorts of online help pages, but I'm only getting more confused. Rather than ask what the problem is, it might be better to go back to square one and ask how you would write this query from scratch. I pasted my current, somewhat convoluted code below, to give you an idea of how I was doing it. But here's what I'm trying to do: Imagine a website with a static page at World: MySite/World. It displays dynamic pages, like these: MySite/World/France, MySite/World/Spain...just as long as "France" or "Spain" match values stored in a database table (gw_geog). In my query, I represent France, Spain and other place names with the variable $MyURL. So I want to query that database table. If $MyURL = 'Japan' (e.g. MySite/World/Japan), then $result should = 1, fetching a web page. If $result = 0 (e.g. a misspelled URL, like MySite/World/Japax), then it fetches a 404 error page. If $result = 2 or more (e.g. MySite/World/Georgia - the name of a country and a U.S. state), then it fetches a duplicate note. I wrote this script years ago, when I didn't know much about PHP/MySQL (I still don't), and I've upgraded my software, so I need to start fresh. Can anyone tell me how YOU would a script to accomplish this task? Thanks. * * * * * Code: [Select] <?php // DATABASE CONNECTION $conn = mysql_connect("localhost", "Username", "Password"); if (!$conn) { echo "Unable to connect to DB: " . mysql_error(); exit; } if (!mysql_select_db("db_general")) { echo "Unable to select db_general: " . mysql_error(); exit; } // DATABASE QUERY $sql = " SELECT COUNT(URL) FROM gw_geog WHERE URL = '$MyURL' "; $sql_result = mysql_query($sql,$conn); $result = $sql_result; // DO SOMETHING WITH THE RESULTS switch ($result) { case 1: echo "\n"; include_once($BaseINC."/$MyPHP/inc/B/DB2/Child/World.php"); include_once($BaseINC."/$MyPHP/inc/B/Child2.php"); include_once($BaseINC."/$MyPHP/inc/D/Child.php"); echo "\n"; break; case 0: include_once($BaseINC."/404.php"); break; default: // More than one results, as in Georgia (state and republic) include_once($_SERVER['DOCUMENT_ROOT']."/Dupe.php"); echo "\n"; break; } ?> Hello All, This is my first post. I have tried getting some help on the PHP channel in IRC but people there always point you to a reference page. I need actual help and example with my code. Possible someone to show/highlight what I did wrong and then show me the correction. First, my code is supposed to create a form. The form (server_select.php) is a pre-populated form that has a drop down box that queries a table from the database. The form then sends the info to get_disk.php page to post the results of the users selected query options. Here is how it's supposed to work: User goes to webpage.tld/index.php. They click on "Select Server Details" page (server_select.php). A form gets loaded User then has to select from the drop down menu's: server, date range from and to and then hit submit User gets sent to get_disk.php The get_disk.php is supposed to show them all of the following info from their selected server and date range: hostname, device name, device size, current usage, remaining size, percentage used, mount point, time stamp. All of that is supposed to show when they user hits submit. Issue: My submit page seems to work but my "get_disk.php" page doesn't seem to know how to query the database correctly. Attached are both of my files. Can someone tell me why my query on the get_disk.php page is not working and how I get it to display my requested info, please? Is it possible to query my database and display results from a varible that changes each time from a users search? I know how to get results from a variable like a field name and display them but i was wondering if for example; the user searches for criteria and gets the result there looking for (postcode); they then click that result in the browser and are redirected to another page with lots more information.(company_name and location). There result from the original search would be different each time but i would like to know if i could take that result and display all other fields in my table associated with that one result. ***Freelistings*** id company_name location postcode 1 Dave's Storage London PO Box1 2 Steve's Trucks Birmingham WS12 3 3 Sue's Tyres Manchester M14 6 4 Paul's Birmingham WS11 7 ***Basicpackge*** id company_name location postcode 1 Storage Ltd London LN12 5TW 2 Fran's Grit Birmingham WS5 37 3 Raj Walls Manchester M14 60 4 Paul's Light's Birmingham WS12 17 ***Premiumuser*** id company_name location postcode 1 Name1 Location1 PC1 2 Name2 Location2 PC2 3 Name3 Location3 PC3 4 Name4 Location4 PC4 I'm sure this can be done, i'm just getting stuck on how to treat the user's search result. Currently it's called '%$var%'. Can i use: $query = "(SELECT company_name, location FROM freelistings WHERE company_name, location like '%$var%') UNION (SELECT company_name, location FROM basicpackage WHERE company_name, location like '%$var%') UNION (SELECT company_name, location FROM premiumuser WHERE company_name, location like '%$var%') ORDER BY postcode"; So that would be looking at all three tables, getting the details from each field that is associated with that (result) postcode. I hope i have given enough information to explain my problem i'm having. for me quite a tough one? any help would be appreciated, thanks guys in advance! in database, I have faced error where query does not responded properly
it was showing the error message that "too much query, user cannot execute more query"....
when I increased the limit, it works for sometime and after sometime, it again generates the error , my question here is:
"why the error is occurring ?"
"what is the correct way to improve the execution of multiple queries at single instance ??? "
So I'm creating a website for bar deals... I've tried for hours trying to get the url to take in more than one parameter with no luck, I don't know if my database isn't setup correctly or something but the url would look like this http://www.site.com/?id=1&day=Monday and when those parameters are passed the deals for that id and day are then posted in the content area I'm pretty much stumped. I feel like it's much easier than I am making it. My database looks like: ID Name Monday Tuesday Wednesday -> and so on 1 Bar1 MondayDeal TuesdayDeal WednesdayDeal 2 Bar2 MondayDeal -> and so on Hi guys, i am currently working on a project that queries an inventory database through the use of radio buttons, for example; If the first button FOR THE Item(HAMMERS)is clicked, the output should be the name of the item, the number sold and the total profit(calculations) into a table. the way i have it now, when io click on the radio button my output comes back as the results for all the items in the table, i want it to display only the information about hammers, then only about each individual item when the corresponding radio button is clicked. any help would be greatly appreciated!!! The title may not fit but only thing i could think of. I am pulling data from MSSQL database table.... I need everything from that table but i need to do some basic math funcitons to the resulting data. So the quesiton is should i do the math for this in the SQL query if so how do i pull all fields and do the math in an effcient way. Or should i let php do the math for me after i get all the data i need. If it is better to use php how can i do this in a while loop and get the math result and not a printed equation. Just looking for a few pointers never had to do math before with php Hi I'm using a couple of queries to search a database. This works well but is slow as I'm cascading/nesting the queries.. Below is an example of what I mean... (LDAP queries) Code: Code: [Select] <? $dn = "cn=user"; $filter="(objectclass=user)"; $justthese = array('cn','telephone','guid','ID','email'); $sr=ldap_search($ds, $dn, $filter, $justthese); $info = ldap_get_entries($ds, $sr); for ($n=0; $n<$info['count']; $n++) { $cn = $info[$n]['cn'][0]; $email = $info[$n]['email'][0]; $id= $info[$n]['id'][0]; $dn = "cn=Device"; $filter="(objectclass=device)(userid=$id)"; $justthese = array('cn','system','guid','ID','userid'); $sr=ldap_search($ds, $dn, $filter, $justthese); $info = ldap_get_entries($ds, $sr); for ($n=0; $n<$info['count']; $n++) { $system = $info[$n]['system'][0]; $userid = $info[$n]['userid'][0]; } } ?> I'm sure there's a better way of writing this... that will make it faster. Thanks Working on a website directory that includes ratings for listed companies. Trying to obtain information from database that would put some companies in a higher category than others. Or at least, I believe that is the approach I should be taking.
There are a few tricky issues.
1. Ratings are their own custom posts but are attached to company pages (parents)
2. Rating values I need to obtain are meta keys (1. total number of ratings & 2. rating average of EACH)
3. Ratings are based on four criteria which are summed and averaged for each rating submitted. As a result, values are rarely single digits such as 4 or 5 but include decimals rounded to 1 place (e.g. 4.8 or 3.5)
Additional info:
Ratings are based on 5-star system (out of 5)
Higher category would be business that achieved at least 10 ratings of 4 or more
Any help appreciated.
I have a test database set up that I am working on. Right now, just some names like so firstName lastName companyName I have used phpmyadmin to insert names in the database. Right now just three names are inserted. One first and last name, one first name and one company name I am getting the results back in an associative array. How can I echo out the information with the break tag, or one field at a time? if I use a break tag, then the loop adds in extra blank lines when it gets to the first name and it's null. Can I test for null values and do it that way? I am a beginner so I have no idea what I am doing. Code: [Select] $result = $mysql->query("select * from names") or die($mysql->error); if($result){ while($row = $result->fetch_assoc()){ $name = $row['firstName']; $lastName = $row['lastName']; $company = $row['companyName']; echo $name . " "; echo $lastName . " "; echo $company . " "; } } |