Jump to content

jbrill

Members
  • Posts

    323
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jbrill's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. ok good call. My current query is: "SELECT * FROM `user_forgot_password` WHERE `hash`='".$hash."'" I have a "date" field that is date stamped when the user requested their password reset. I would like to give them one day to reset their password or else it would expire. how would i do this in an SQL statement?
  2. Thanks for your help, but i want to do this in php, not using mysql. how would i do this?
  3. Hey guys, I have an entry in the database that holds the date (Y-m-d). Im simply trying to add 1 day to it. example: if the date in the database is 2009-04-06 in my php code i want to add grab that date and add 1 day to it so it would be 2009-04-07. how would i go about doing this?
  4. Hey guys, It's been a while since ive been on here but i'm having troubles with a Mysql Join statment I just can't seem to figure out... I have 3 tables invloved here: 1) dynamica_makes ->this table holds the id and make name of the vehicle eg: (1,Honda) 2) dynamica_models -> this table holds the id, an id of the the corresponding make and the model name. eg:(5,1,Civic) 3) dynamica_inventory -> this table holds the complete line of inventory the dealership is selling. it has the following fields: id, make(holds the appropriate make id), model (holds the appropriate model id), year, stock_number, price. now, the problem im running into is i can join two tables (for example, dynamica_makes and dynamica_inventory) so that it shows the make's actual name rather than the id stored in the dynamica_inventory table's column for "make" but i cannot get it to do the same and also join the dynamica_models table. here is the current code: $sqlhead = "SELECT dynamic_vehicles.id, dynamic_vehicles.model, dynamic_vehicles.make, dynamic_vehicles.trim, dynamic_vehicles.year, dynamic_vehicles.vin, dynamic_vehicles.odometer, dynamic_vehicles.color, dynamic_vehicles.interior_color, dynamic_vehicles.motor, dynamic_vehicles.transmission, dynamic_vehicles.drive, dynamic_vehicles.doors, dynamic_vehicles.price, dynamic_vehicles.stock_num, dynamic_vehicles.sold, "; $sqljoin = "dynamic_makes.make AS makename FROM dynamic_vehicles JOIN dynamic_makes ON dynamic_vehicles.make = dynamic_makes.id "; $sqlwhere = " WHERE dynamic_vehicles.make = dynamic_makes.id"; $sqlitem = " ORDER BY makename ASC"; $prodsql = $sqlhead.$sqljoin.$sqlwhere.$sqlitem; $prodresult = mysql_query($prodsql) or die(mysql_error()); while($prod = mysql_fetch_array($prodresult)) { echo $prod['makename'] ." "; echo $prod['model'] ."<br />"; //need to get the modelname here to work and display the ACTUAL model name of the vehicle not the id } .
  5. ok, so i got some models being displayed, but they are not the proper ones that are set to active=1 here is my code $sql = mysql_query("SELECT make.id, make.make,vehicles.active FROM dynamic_vehicles AS vehicles, dynamic_makes AS make WHERE vehicles.active='1' AND vehicles.id = make.id GROUP BY vehicles.make ORDER BY make.make ASC") or die(mysql_error()); while($make = mysql_fetch_array($sql)) { if($make['active']==1) { echo '<li><a href="#" title="'.$make['make'].'">'.$make['make'].'</a></li>'; } }
  6. k i check it and got this: Unknown column 'make.id' in 'field list'
  7. this is the error im getting: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/dynamica/public_html/test/includes/header.php on line 27 here is the tables structure: dynamic_vehicles: id,date_added,cat,make,model,year,vin,odometer,color,interior_color,motor,transmission,drive,doors,passengers,description,warranty,options,price,stock_num,active,sold,featured dynamic_make: id, make
  8. Well basically I need the to check against dynamic_vehicles and only show the "model" from the dynamic_models table if the vehicle is set to active=1 here is the code so far: $sql = mysql_query("SELECT make.id, make.make,vehicles.active FROM dynamic_vehicles AS vehicles, dynamic_makes AS make WHERE vehicles.id = make.id AND vehicles.active='1' ORDER BY make.make ASC"); while($make = mysql_fetch_array($sql)) { echo '<li><a href="#" title="'.$make['make'].'">'.$make['make'].'</a></li> '; }
  9. nope, that didnt work either, any other suggestions guys?
  10. noope, now im getting an sql error: MySQL said: #1054 - Unknown column 'make.active' in 'where clause'
  11. here is the code i jsut ran in phpmyadmin SELECT make.id, make.make,vehicles.active FROM dynamic_vehicles AS vehicles, dynamic_makes AS make WHERE vehicles.id = make.id AND vehicles.active='1' ORDER BY make.make ASC this is showing all the models in the "models" table i need to only show the model IF a vehicle in the "vehicles" table is active=1
  12. actually, one more thing... here is the code right now: $sql = mysql_query("SELECT make.id, make.make,vehicles.active FROM dynamic_vehicles AS vehicles, dynamic_makes AS make WHERE vehicles.id = make.id ORDER BY make.make ASC"); while($make = mysql_fetch_array($sql)) { if($make['active']==1) { echo '<li><a href="#" title="'.$make['make'].'">'.$make['make'].'</a></li> '; } } I have a field in the "dynamic_vehicles" table called "active" if active is "1" then i want it to show the models that are active and not the other ones. I tried adding "AND vehicles.active='1' " but it did not work
  13. hey just looking for some quick help with this join statement thnx $sql = mysql_query("SELECT make.id, make.make FROM dynamic_vehicles, dynamic_makes WHERE vehicles.id = make.id"); while($make = mysql_fetch_array($sql)) { echo '<li><a href="#" title="'.$make['make'].'">'.$make['make'].'</a></li> '; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.