PHP - Row Count Issue (beginner Question)
My table has 250 rows, but COUNT only seems to see 162 of them. In phpMyAdmin, for instance, there is a notice in the browse tab: "Showing rows 0-161 (162 total, Query took 0.0030 sec)". On one of my php pages, I get the same 162 result from this attempt to count the number of entries to my auto-incrementing "id" column :
$result = mysql_query('SELECT COUNT(id) AS id_count FROM MyTable)';Can anyone suggest the kinds of things I should check/adjust to understand why about 90 rows are not being counted? Many thanks in advance for any help anyone can offer. Similar TutorialsError... Parse error: syntax error, unexpected T_ELSE in /home/smileits/public_html/space/webmin/install.php on line 15 Code... Code: [Select] <?if ($_GET['a'] == "") {?><br><br><div align="center"><h2>Welcome to aWebBB</h2><br><br>After editing the configuration file located at /forum/config.php and created a database named 'awebbb_forum' (or different) please click <a href="install.php?a=install">here</a> to install.<br></div><?} else { }if ($_GET['a'] == "install") {echo "Installing MYSQL Tables...<br>";include "../config.php";$db = mysql_connect($db_host,$db_user,$db_pass); mysql_select_db ($db_name) or die ("Cannot connect to database"); $query = 'CREATE TABLE `fcat` ( `id` int(11) NOT NULL auto_increment, `category` varchar(50) default NULL, `description` varchar(250) default NULL, PRIMARY KEY (`id`))';$result = mysql_query($query); echo "Created Categories Table<br>";$query2 = 'CREATE TABLE `flist` ( `id` int(11) NOT NULL auto_increment, `tid` varchar(50) default NULL, `categories` varchar(30) default NULL, `tname` varchar(100) default NULL, `poster` varchar(50) default NULL, `date` date default NULL, PRIMARY KEY (`id`))';$result2 = mysql_query($query2); echo "Created Thread List Table<br>";$query4 = 'CREATE TABLE `forum` ( `id` int(11) NOT NULL auto_increment, `tid` varchar(50) default NULL, `categories` varchar(30) default NULL, `tname` varchar(100) default NULL, `poster` varchar(30) default NULL, `fpost` text, `sig` varchar(150) default NULL, `avatar` varchar(150) default NULL, `time` time default NULL, `date` date default NULL, PRIMARY KEY (`id`))';$result4 = mysql_query($query4); echo "Created Main Fourm Table<br>";$query5 = 'CREATE TABLE `prefs` ( `id` int(11) NOT NULL auto_increment, `sitename` varchar(99) default NULL, `forumname` varchar(99) default NULL, `sitetitle` varchar(99) default NULL, `menulink` varchar(11) default NULL, `normallink` varchar(11) default NULL, `defimage` varchar(150) default NULL, `defsig` varchar(150) default NULL, `backcolor` varchar(20) default NULL, `msitecolor` varchar(20) default NULL, `siteurl` varchar(150) default NULL, `headimage` varchar(150) default NULL, `hiwidth` varchar(4) default NULL, `hiheight` varchar(4) default NULL, `forumcolor` varchar(11) default NULL, `normaltext` varchar(11) default NULL, `copyright` varchar(150) default NULL, `email` varchar(100) default NULL, `adenable` varchar(11) default NULL, `adcode` text, `adlocation` varchar(20) default NULL, PRIMARY KEY (`id`))';$result5 = mysql_query($query5); $query7 = "INSERT INTO `prefs` VALUES (1, 'Site Name', 'Forum Name', 'Title of your site', 'white', 'blue', 'images/world.jpg', 'Love Life', 'white', 'blue', '', 'images/logo1.jpg', '700', '80', 'white', 'black','','','','','');"; mysql_query($query7); echo "Created Preferences Table<br>";$query6 = 'CREATE TABLE `users` ( `id` int(11) NOT NULL auto_increment, `level` char(2) default NULL, `username` varchar(20) default NULL, `password` varchar(20) default NULL, `emailadd` varchar(50) default NULL, `fullname` varchar(40) default NULL, `country` varchar(30) default NULL, `date` date default NULL, `sig` varchar(150) default NULL, `avatar` varchar(150) default NULL, PRIMARY KEY (`id`))';$result6 = mysql_query($query6); echo "Created Users Table<br>"; $query7 = 'CREATE TABLE `menu` ( `id` int(11) NOT NULL auto_increment, `bname` varchar(50) default NULL, `link` varchar(200) default NULL, PRIMARY KEY (`id`) )'; $result7 = mysql_query($query7); echo "Created Menu Table<br>";echo '<meta http-equiv="refresh" content="1;url=install.php?a=users">'; } else { }if ($_GET['a'] == "users") {?>Please Create the Administrative User Account:<br><br><style type="text/css"><!--div.error-box {width:200px; background:pink; margin-top: 2px; border: 1px solid red; text-align: center;}//--></style><?$a=$_GET['b'];if ($a == "skyreg" ) {$fullname=$_POST['fullname'];$username=strtolower($_POST['username']); $password1=$_POST['password1'];$password2=$_POST['password2'];$emailadd=$_POST['emailadd'];$country=$_POST['country'];if ($fullname == "") {$fullnamebox="<div class=\"error-box\">";$fullnamebox1="</div>";} else { }if ($username == "") {$usernamebox="<div class=\"error-box\">";$usernamebox1="</div>";} else { }if ($password1 == "") {$pword1box="<div class=\"error-box\">";$pword1box1="</div>";} else { }if ($password2 == "") {$pword2box="<div class=\"error-box\">";$pword2box1="</div>";} else { }if ($emailadd == "") {$emailaddbox="<div class=\"error-box\">";$emailaddbox1="</div>";} else { }if ($country == "") {$countrybox="<div class=\"error-box\">";$countrybox1="</div>";} else { }if ($fullname == "" OR $username == "" OR $password1 == "" OR $password2 == "" OR $emailadd == "" OR $country == "") {$errormessage="<font color=\"red\">Please Fill in all Feilds.</font><br>";} else { include "../config.php";$db12 = mysql_connect($db_host,$db_user,$db_pass); mysql_select_db ($db_name) or die ("Cannot connect to database"); $query12 = "SELECT username FROM users WHERE username = '$_POST[username]'"; $result12 = mysql_query($query12); while($r=mysql_fetch_array($result12)) { $username12=$r["username"]; }if ($username12 == $username) {$errormessage3="<font color=\"red\">The username chosen is in use, choose another.</font>";} else { if ($password1 == $password2) {$fullname=$_POST['fullname'];$username=strtolower($_POST['username']); $password=$_POST['password1'];$emailadd=$_POST['emailadd'];$schoolyear=$_POST['schoolyear'];$country=$_POST['country'];$defsig1=$_POST['defsig'];$defimage1=$_POST['defimage'];include "../config.php"; // As you can see we connected to the database with config$db = mysql_connect($db_host, $db_user, $db_pass); mysql_select_db ($db_name) or die ("Cannot connect to database"); $query = "INSERT INTO users(level, username, password, emailadd, fullname, country, date, sig, avatar) VALUES('1', '$username','$password','$emailadd','$fullname', '$country', now(), '$defsig1', '$defimage1')"; mysql_query($query); echo "Account Created";echo '<meta http-equiv="refresh" content="1;url=install.php?a=done">'; mysql_close($db); } else {$errormessage2="<font color=\"red\">Passwords Entered do not Match.</font>";}}mysql_close($db12);}} else { }if ($a != "skyreg" OR $a != "reg") { ?><div align="center"><?=$errormessage;?><?=$errormessage2;?><?=$errormessage3;?><br><form method="post" action="install.php?a=users&b=skyreg"><input type="hidden" name="defimage"><input type="hidden" name="defsig"><?=$fullnamebox;?>Full Name:<br><input type="text" name="fullname"><br> <?=$fullnamebox1;?><?=$usernamebox;?>Username:<br><input type="text" name="username"><br> <?=$usernamebox1;?><?=$pword1box;?>Password:<br><input type="password" name="password1"><br> <?=$pword1box1;?><?=$pword2box;?>Retype Password:<br><input type="password" name="password2"><br> <?=$pword2box1;?><?=$emailaddbox;?>E-mail Address:<br><input type="text" name="emailadd"><br> <?=$emailaddbox1;?><?=$countrybox;?>Country:<br><input type="text" name="country"><br> <?=$countrybox1;?><input type="reset" value="Clear Form"> <input type="submit" value="Register"></form></div><? } else { }} else { }if ($_GET['a'] == "done") {?><div align="center"><br><br>All done!!!<br><br>Please procede to the <a href="index.php">Admin section</a> and Edit the <a href="pref_edit.php">site preferences</a>.<br><br><font color="red"><h2>Remember to delete install.php AND upgrade.php for security reasons!!!</h2></font></div><?} else { }?> Hi all For example if you see this code: public function __set($varName,$varValue) { $this->$varName = $varValue; if ($varName == "varOne") { $this->varTwo = $this->varOne * 9; } } Why somewhere dollar sign exists and somewhere not: $this->$varName , $this->varTwo ? Thanks <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="stylesheet.css"> <meta charset="utf-8"> </head> <body> <?php $array = array(); echo "<table>"; for ($z=0; $z <=9; $z++) { echo "<tr>"; for ($s=0; $s <=9; $s++) { $r = mt_rand (1, 100); array_push ($array, $r); if ($r %2 != 0) { echo "<td bgcolor = red>"; echo $r; echo "</td>"; } else { echo "<td bgcolor= lightgreen>"; echo $r; echo "</td>"; } } echo "</tr>"; } echo "</table>"; echo "<br>"; echo "<table>"; sort($array); $arraysplit = array_chunk($array, count($array)/10); for ($z=0; $z <=9; $z++) { echo "<tr>"; for ($s=0; $s <=9; $s++) { if ($r %2 != 0) { echo "<td bgcolor = red>"; echo json_encode (arraysplit); echo "</td>"; } else { echo "<td bgcolor= lightgreen>"; echo json_encode ($arraysplit); echo "</td>"; } } echo "</tr>"; } ?> </body> </html> Hey absolute beginner here. Im working on a table that gives random numbers out and then colorizes them if they can be devided by 2. That works fine. Now i want to get those randomly generated numbers into a second table but sorted. I already managed to put the numbers i generated into an array and sort it but i cant figure out how to echo them 1 by 1 into the table. Maybe you can help me out. I have a search box with an input box. When the user enters a string in this box and then when it clicks submit, the form needs to go to the http://ww.mywebsite.com/wp-content/uploads/<?php echo $_POST["name"]; ?>.jpg where $_POST["name"] is what the user entered. how to make it work?? <form action="http://ww.mywebsite.com/wp-content/uploads/<?php echo $_POST["name"]; ?>.jpg" method="post" target="_blank"> <!-- form fields here --> <INPUT TYPE = "Text" NAME = "name"> <input type="submit" /> </form> I'm a beginner with php, but I have a few nifty things working, and I'm trying to enhance my project to do something at the next level. The project is a library database search tool, and I'm having trouble getting from the search results to the page which shows a record for an individual book. The search tool works well, and works a few different ways, so I feel I should be able to get this, but this is a first attempt.
I'm stuck on where and how to use $_GET. If I understand what I need to do, it's something like this:
My search results page has a link as part of the last column:
My first question is, how do I parse this link in php so that it pulls the Id. number from the database, (so that "Link" points to /book.php?0140441638 as a uri? That column looks something like this:
On the next page, (book.php) which should be the page which shows the information for the individual book, after connecting to my database I have $query="SELECT * FROM MyTable WHERE id='0140441638'". How would I go about passing the '0140441638' from the referring link?
The next question is how to concatenate this with the openlibrary link in the screenshot -- so that it is passed like src='..//covers.openlibrary.org/b/isbn/**RESULT**-L.jpg' />
Thank you to anyone who can help me with this!
Ok I am testing foreach in an array as my practice. I wonder how can I assign values in the key of the array.. Here's the code Code: [Select] <?php $username = me_mysql_prep(trim($_POST['username'])); $first_name = me_mysql_prep(trim($_POST['first_name'])); $last_name = me_mysql_prep($_POST['last_name']); $email = me_mysql_prep($_POST['email']); $position = me_mysql_prep($_POST['Position']); $password = me_mysql_prep($_POST['password']); $hashed_password = sha1($password); $required_fields = array($username,$first_name,$last_name, $email, $position, $password); foreach($required as $key => $value) { if($value == "") { echo $key . " Cannot be empty<br>"; } } ?> So the result would be like this... IF username, first name and last name are EMPTY it will echo: Quote username cannot be empty first name cannot be empty last name cannot be empty Anyone? Hi All, The following code works but for some reason it is leaving 1 result off of each page when displaying results from DB. I assume there is something wrong with the count but I cannot find the problem. Thank you for any help. Code: [Select] <?php $page = $_GET['page']; $result2 = mysql_query("SELECT * FROM vendors WHERE vendor_type_id = '$vdrt' AND active ='Yes' ORDER BY RAND()"); $total_results = mysql_num_rows($result2); if (empty($total_results)) {echo "Sorry, but we do not have any results for that search at this time. <br/><br/><a href='index.php'>Please try your search again</a>";} else { $total_pages = ceil($total_results / $results_limit); // $results_limit is set to 7 in config file if (empty($page)) { $page = "1"; } $offset = ($page - 1) * $results_limit; $result = mysql_query("SELECT * FROM vendors WHERE vendor_type_id = '$vdrt' AND active ='Yes' LIMIT $offset, $results_limit") or die ("$DatabaseError"); $row = mysql_fetch_assoc($result); $vendor_type_id = $row['vendor_type_id']; $num = mysql_numrows($result); if ($num == 0) : print "<br><br><p>Sorry, no vendors could be found.</p><br><br>"; elseif ($num > 0) : echo "Page - "; if ($page != 1) { echo "<a href=$PHP_SELF?city=Orlando&state=FL&vdrt=$vendor_type_id&page=1><< First</a> "; $prevpage = $page - 1; } if ($page == $total_pages) { $to = $total_pages; } elseif ($page == $total_pages-1) { $to = $page+1; } elseif ($page == $total_pages-2) { $to = $page+2; } else { $to = $page+3; } if ($page == 1 || $page == 2 || $page == 3) { $from = 1; } else { $from = $page-3; } for ($i = $from; $i <= $to; $i++) { if ($i == $total_results) $to=$total_results; if ($i != $page) { echo "<a href=$PHP_SELF?city=Orlando&state=FL&vdrt=$vendor_type_id&showold=yes&page=$i>$i</a>"; } else { echo "<b><span class='current-page'>[$i]</span></b>"; } if ($i != $total_pages) echo " "; } if ($page != $total_pages) { $nextpage = $page + 1; echo " <a href=$PHP_SELF?city=Orlando&state=FL&vdrt=$vendor_type_id&page=$total_pages>Last >></a>"; } if ($num == 0) { echo "<br><br>";} else {echo "<br><br>";} $i = 0; while ($i < $num) : while ($row = mysql_fetch_assoc($result)) { $vdrid = $row['vendor_id']; $vendor_name = $row['vendor_name']; $vendor_name_enc = urlencode($row['vendor_name']); $vendor_city = $row['vendor_city']; $vendor_state = $row['vendor_state']; $vendor_phone = $row['vendor_phone']; $vendor_overview = $row['vendor_overview']; // Trim overview if(strlen($vendor_overview) > 385) {$trimed_vendor_overview = substr($vendor_overview,0,385) . "..."; } else { $trimed_vendor_overview = $vendor_overview; } echo "<strong><a href='listing.php?$vendor_name_enc-$vendor_city-$vendor_state-&vdrid=$vdrid'>$vendor_name</a> </strong> - $vendor_city, $vendor_state $vendor_phone<br/>"; echo "$trimed_vendor_overview<br/><br/>"; } $i++; endwhile; endif; } ?> I need to add a condition to a while() statement I have. It should run when $counter is less than the number of records in my $products array which has 5 products. I set $counter and $product_no to 0. I need to use the count() function to get the number of records. Does that make sense? Do ya'll need more info. Any help is Greatly appreciated. Ive referenced and searched but cant figure out how to incorporate it. Im still learning. Peace, Skrappy Hello dear friends, hello community, i want to parse a site http://www.aktive-buergerschaft.de/buergerstiftungsfinder Well therefore i have a true beginner-question regarding Array in order to work with the data: beginner question The results should be stored in a MySQL-Database: well you see. i have a Curl-Approach: and i want to work with the parsed data: and in this case i want to give over the data into an array (if viewing the output in web browser, do view-source to see structured array). Here the musings that led to the code: Depending on num dimensions, we could do, foreach($result as $k => $v) {echo $k." ".$v} to view and work with data (adding sub foreach loops accordingly; i.e. if $v is itself an array) see the results: What do you think: Code: [Select] $ch = curl_init("http://www.aktive-buergerschaft.de/buergerstiftungsfinder"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $buffer = curl_exec($ch); curl_close($ch); $result = explode(",", $buffer); foreach($result as $k => $v) {echo $k." ".$v} if $v is itself an array) // print_r($result); look forward to hear from you!! db1 SELECT COUNT(*) obviously counts all records matching the WHERE clause, however... Field1 / Field2 1 / A / A 1 / B 1 / A I want to count all records where Field2 is "A", but if Field1 is set to "1" then that record counts as half. So above would return a result of 2 (one and two halfs = 2) I'm sure SQL can do this without the need to perfrom PHP calculations. Hope this makes sense. Thanks in advance. Hi guys, Sorry - I know this is a basic question but I've been out of the game for a year now and need to jog my memory. I am trying to count the number of rows per group. e.g: $sql = "SELECT *, COUNT(id) FROM image GROUP BY city"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); echo $row['COUNT(id)']; So if there are, for example, 5 New York's in the table, 3 London's and 2 Sydney's I want the echo to display 5, 3, 2 Should I use a loop for this? Cheers Hi guys, I need your help. I am trying to insert the rows in the mysql database as I input the values in the url bar which it would be like this: Code: [Select] www.mysite.com/testupdate.php?user=tester&pass=test&user1=tester&email=me@shitmail.com&ip=myisp However i have got a error which i don't know how to fix it. Error: Column count doesn't match value count at row 1 <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'mydbusername'); define('DB_PASSWORD', 'mydbpassword'); define('DB_DATABASE', 'mydbname'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $username = clean($_GET['user']); $password = clean($_GET['pass']); $adduser = clean($_GET['user1']); $email = clean($_GET['email']); $IP = clean($_GET['ip']); if($username == '') { $errmsg_arr[] = 'username is missing'; $errflag = true; } if($password == '') { $errmsg_arr[] = 'PASSWORD is missing'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $sql = "INSERT INTO `members` (`username`,`email`,`IP`) VALUES ('$adduser','$email','$IP')"; if (!mysql_query($sql,$link)) { die('Error: ' . mysql_error()); } echo "The information have been updated."; } ?> Here's the name of the columns i have got in my database: Code: [Select] username IP I have input the correct columns names, so I can't correct the problem I am getting. Please can you help? This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=331562.0 Why am I getting this error when there are 3 Fields with 3 values? Column count doesn't match value count at row 1 Code: [Select] $sql5="INSERT INTO participants (participant_name, team_no, sport) VALUES ('".implode("','$_POST[team]'),('",$_POST['participant_name'])."','$_POST[team]','$sport')"; Anyone can help me? <?php $tbl_name="menu"; $kategorije = mysql_query("SELECT * FROM $tbl_name WHERE Left(menu_name, 1) BETWEEN 'A' AND 'M' ORDER BY menu_name ASC"); if (!$kategorije) { die("Database query failed: " . mysql_error()); } while ($row=mysql_fetch_array( $kategorije )) { echo "<div id=lista-header><h4>{$row["menu_name"]}</h4></div>"; $id_sub=$row['id_menu']; $podkategorije = mysql_query("SELECT * FROM submenu WHERE id_menu=$id_sub ORDER BY sub_name ASC", $connection); if (!$podkategorije) { die("Database query failed: " . mysql_error()); } echo "<ul class=\"pod\">"; while ($pod=mysql_fetch_array( $podkategorije )) { echo "<li><a href=index.php?=podkate?".$pod["id_sub"]." class=black>{$pod["sub_name"]}</a><hr size=1 align=left width=100px color=#cccccc></li>"; } echo "</ul>"; } ?> In this way, I get list with categories and hes subcategories. How to count how many subcategories have each categories, and count how many articles have each categories? Example (I wanna get this kind of look): Categories name (3) subcategoriesname (2) subcategoriesname (4) subcategoriesname (7) Categories name (5) subcategoriesname (1) subcategoriesname (14) subcategoriesname (9) subcategoriesname (2) subcategoriesname ( Categories name (2) subcategoriesname (28) subcategoriesname (17) Where the numbers represent how many categories and sub-items have articles Hi guys, first post here from a relative newbie I'm working on my final project for php and I'm running into a bit of a road block. The error is I'm trying to validate which radio button is checked to run a corresponding function to either add a car, drop a car, or display a car. Everything seems to work fine but my if statement won't pick up the change and therefore my function won't run. This is the output that I receive from the code. [taken from the bottom of the php when I select Add Car(s) on the form] input = 11112111421 add_status=add_status unchecked=unchecked Here's the script and htm form. Code: [Select] <html> <head> <title>Final Project</title> </head> <body> <form action="final.php" method="post"> <input type="radio" name="query" value="add_status" /> Add Car(s) <br /> <input type="radio" name="query" value="delete_status" /> Delete Car(s) <br /> <input type="radio" name="query" value="display_status" /> Display Car(s) <br /> <input type="text" name="Input_Car_ID" /> Car ID <br /> <input type="text" name="Input_Car_Make" /> Car Make <br /> <input type="text" name="Input_Car_Model" /> Car Model <br /> <input type="text" name="Input_Car_Vin" /> Car Vin <br /> <input type="text" name="Input_Car_Color" /> Car Color <br /> <input type="text" name="Input_Car_Mileage" /> Car Mileage <br /> <input type="Submit" value="Query" /> </form> </body> </html> <!-- Radio button selects which functions to run. Leave blank to view all --> <?php /* final.php Name: Peter Cort Date: 4/25/2012 Script: Final Project */ $add_status = "unchecked"; $drop_status = "unchecked"; $display_status = "unchecked"; extract($_POST, EXTR_SKIP); if (isset ($Submit)){ if ($query == "add_status") { $add_status = "checked"; } else if ($query == "drop_status") { $drop_status = "checked"; } else if ($query == "display_status") { $display_status = "checked"; } } function runsql(){ /*mysql_connect("sftweb01", "cort", "peter");*/ mysql_connect("localhost", "peter", "cort"); mysql_select_db("cort"); } runsql(); if ( empty($Input_Car_ID)) { $Input_Car_ID = ""; } if ( empty($Input_Car_Make)) { $Input_Car_Make = ""; } if ( empty($Input_Car_Model)) { $Input_Car_Model = ""; } if ( empty($Input_Car_Vin)) { $Input_Car_Vin = ""; } if ( empty($Input_Car_Color)) { $Input_Car_Color = ""; } if ( empty($Input_Car_Mileage)) { $Input_Car_Mileage = ""; } class car{ private $Car_ID; private $Car_Make; private $Car_Model; private $Car_Vin; private $Car_Color; private $Car_Mileage; public $Input_Car_ID; public $Input_Car_Make; public $Input_Car_Model; public $Input_Car_Vin; public $Input_Car_Color; public $Input_Car_Mileage; /* function for setting no input values to null (will be able to delete on multiple paramaters) */ /* function needs to get values from the .htm form */ function __construct($Input_Car_ID, $Input_Car_Make, $Input_Car_Model, $Input_Car_Vin, $Input_Car_Color, $Input_Car_Mileage) { $this->Car_ID = $Input_Car_ID; $this->Car_Make = $Input_Car_Make; $this->Car_Model = $Input_Car_Model; $this->Car_Vin = $Input_Car_Vin; $this->Car_Color = $Input_Car_Color; $this->Car_Mileage = $Input_Car_Mileage; } function add_vehicle() { if (($Car_ID == "") && ($Car_Make == "") && ($Car_Model == "") && ($Car_Vin == "") && ($Car_Color == "") && ($Car_Mileage == "")) { print "Please provide information about the car you wish to add"; } else mysql_query("INSERT INTO Car_T (Car_ID, Car_Make, Car_Model, Car_Vin, Car_Color, Car_Mileage) VALUES ('$this->Car_ID', '$this->Car_Make','$this->Car_Model', '$this->Car_Vin', '$this->Car_Color', '$this->Car_Mileage')"); } function drop_vehicle() { if (($Car_ID == "") && ($Car_Make == "") && ($Car_Model == "") && ($Car_Vin == "") && ($Car_Color == "") && ($Car_Mileage == "")) { print "Please provide information about the car you wish to delete"; } else mysql_query("DELETE FROM Car_T WHERE Car_ID = '$this->Car_ID' AND Car_Make='$this->Car_Make' AND Car_Model='$this->Car_Model' AND Car_Vin='$this->Car_Vin' AND Car_Color='$this->Car_Color' AND Car_Mileage='$this->Car_Mileage'"); } function display_vehicle() { if (($Car_ID == "") && ($Car_Make == "") && ($Car_Model == "") && ($Car_Vin == "") && ($Car_Color == "") && ($Car_Mileage == "")) { $display_query = mysql_query("SELECT * FROM Car_T"); } else $display_query = mysql_query("SELECT * FROM Car_T WHERE (Car_ID = '$this->Car_ID' OR Car_Make = '$this->Car_Make' OR Car_Model = '$this->Car_Model' OR Car_Vin = '$this->Car_Vin' OR Car_Color = '$this->Car_Color' OR Car_Mileage = '$this->Car_Mileage')"); while($row = mysql_fetch_row($display_query)){ echo $row['$this->Car_ID']; print "<br />"; } } function display_stuff() { echo $this->Car_ID; echo $this->Car_Make; echo $this->Car_Model; echo $this->Car_Vin; echo $this->Car_Color; echo $this->Car_Mileage; } } $new_entry = new car($Input_Car_ID, $Input_Car_Make, $Input_Car_Model, $Input_Car_Vin, $Input_Car_Color, $Input_Car_Mileage); if ($add_status == 'checked'){ $new_entry->add_vehicle(); } if ($drop_status == 'checked'){ $new_entry->drop_vehicle(); } if ($display_status == 'checked'){ $new_entry->display_vehicle(); } print "<br />"; print "input = "; $new_entry->display_stuff(); print "<br />"; print "$query"; print "="; print $query; print "<br />"; print "$add_status"; print "="; print $add_status; /* $Car_ID, $Car_Make, $Car_Model, $Car_Vin, $Car_Color, $Car_Mileage print $Input_Car_ID; print $Input_Car_Make; print $Input_Car_Model; print $Input_Car_Vin; print $Input_Car_Color; print $Input_Car_Mileage; print "<br />"; */ ?> My second part of this is wondering how to construct my display query to run right. I'd like to be able to run it on any possible input from the text box. I basically want to do something like (WHERE LIKE '%') where there isn't an input from the htm form. My thought was to build the query on a series of concatenations through a function, but that seems like a lot of work. I just feel like it's important to give that functionality to the program. Thanks for looking, and hopefully I don't confuse you readers that much :3 Also I know that the mysql_query(); is going out of style but just go with it for the sake of my sanity Ok here it is, seems like it is an easy problem but my developers are having some issue with this, I hope you guys can help. Basic question and answer problem, where I am developing a website that uses Items and questions like " How many of this Item do you need?" the answer seems to simple. Lets say the answer Is "1". The display is given to the Item list and we move on. Here is the Problem: When selecting Muiltiple Items in the List and they all have the same question associated to each Item: "How Many Items do you need?" the the answer is shared between the Items, Again, sounds simple so far, However, when the USER selects Multiple Items on a list say 30 Items then the Question should only be dispalyed one time, not 30 times, then the answer is shared 30 times. Thats what I have now being displayed on my website, 30 of the same questions over and over again. The USER will get frustrated and leave the site never to return. Question: How can I get the Question to be displayed only once, but shared between several items on a list? This is a very serious problem fo my website because I will have not have just one Item on a list but 300 to 400 items, and if I get the answer to the problem I have just wasted 1 year of my life developing something undevelopable (is that a word?). Any Help you can give me would greatly be appricated. Thank you in advance. please help me in php i want that when a user clicks on add click a new box will be appeared for question consider user is doing work with questions and options he first gives a question after it he clicks on ADD button so a input box will appear den he clicks again to ADD button den aggain new box appears at last he clicks save then they would be inserted into database reply mee.. please |