Slow and No

A

Anonymous

Guest
Well thanx Alexei Kubarev for locking my topic. Your such a sweetheart. I thought I would be able to find answers and some help here at this forum but apparently that isn't a possiblity. How lame is that. Your first answer was so vague and now you don't have any answer for my post except to lock it out from any help. Well so much for trying to get anyones attention. I'll have to look else where since this forum is so blah~!@
 
macrunning said:
Well thanx Alexei Kubarev for locking my topic. Your such a sweetheart. I thought I would be able to find answers and some help here at this forum but apparently that isn't a possiblity. How lame is that. Your first answer was so vague and now you don't have any answer for my post except to lock it out from any help. Well so much for trying to get anyones attention. I'll have to look else where since this forum is so blah~!@
What is your question?

P.S.
Alex do not delete or block him please
 
the thing was that he double posted the SAME topic...
as it looked like to me: he described the smae problem in 2 different topics.. please refere to this topic http://www.php-forum.com/p/viewtopic.php?t=6223

THe topic that i have locked is: http://www.php-forum.com/p/viewtopic.php?t=6225

Anything simmilar?! :)

as for me: 2 topics describing the same problem with different words... posted by the same person... the same day..

This violates our rules and you know it..

Anyways.. prove me wrong and the topic will be unlocked...
Dont worry Wizard -- i dont block people after they've insulted me...
 
Oh thats cute, Bart Simpson. Yah high I'm in 8th grade. I can see we have teenagers running ship here. In case you didn't see the question I think it's something a little bit more complex than submitting a question to google. And if your answer is to go ask google then what the hell kind of forum is this suppose to be. Any other forum for coding I've been on has been extremely helpful, I'm not so sure I can say that about this one when responses to questions are vague and null and then little kiddy antics are used to piss your posters off. The question I had was in regards to multiple calls to a database through 3 select fields. I posted the url for you guys and the code to see where I'm going wrong. I've spent countless hours on this, reading and searching (google was one of them), and haven't been able to find the answer. I thought I would resort to the forum as a last resort, hence only being a member for 1 day now. So if you guys had an answer I would be extremely thankful but if the idea is to play games then nothanks, this isn't for me.
 
Listen! are you going to insult us or what?!

Wizard is not a teenager as he is over 20.. he knows PHP alteast as much as I do...
Just calm down and think about it: why get pissed for simly locking your topic when you double posted? whats the point of 2 diferent topics?
I will close my eyes on your third topic as i just dont like having conflicts..

Just so you know: ALL moderators are highly experienced and simply want to keep this forum clean: so if we do something: its in most cases because we are trying to make this forum look good...

So take my advice: Calm the f**k down and just wait for us to figure your problem out
 
Ok, I'm sorry for any insults I threw out. I'm not looking for any headaches either. I just thought it was rude to lock the post when all I was trying to do is get an answer to my original question. I didn't think anyone was listening since there was no answer to the question so I thought I would post it again and maybe get an answer the second time. I'm calm, almost finised with my morning coffee. 'Excuse the tude but I haven't eaten today ' - Alice in Chains
 
Oh, and since the original posting I think I've figured out how to piggy back my query from the year field to the make field but now I get an error message to the tune of 'You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0,20' at line 1.
The url in my address bar is now reading correctly where it will display the url?year=2004&make=CHEVY but the above error now appears. Not sure what it has to do with the SQL statement I'm making because in the code it's $maxRows_Recordset1 = 20; that the error is referencing to.
 
ITs okej..the thing is thet youve re-posted the topic the same day after posting the original one... you should know that it may take a while untill we can fgure out all the problems with your code.. i recon giving you an idea how to do the sorting you wanted to... and here is more information:

you create a form with 3 drop boxes
its best that the form will be submited by a button (Resort)

When that button is pushed: the form will post values of the dropbox to the URL (method='GET')

After that you will retrieve data from the url and query the database..
for each dropbox you will also have to move the "selected" property between the options..
for instance:

This is what we get after user chose to sort by name and model:
Code:
url is: page.php?first_box=name&second_box=model
$_GET['first_box'] == name
$_GET['second_box'] == model

Now... you want to make first_box select value name and second to have model selected:

Code:
<?php

$sel_1[$_GET['first_box']] = "selected";
$sel_2[$_GET['second_box']] = "selected";

echo("<form method='GET' action='page.php'>
<select name='first_box'>
  <option value='year' ".$sel_1['year'].">Year</option>
  <option value='name' ".$sel_1['name'].">Name</option>
  <option value='something' ".$sel_1['something'].">something</option>
</select>

<select name='second_box'>
  <option value='name' ".$sel_2['model'].">Model</option>
  <option value='manuf' ".$sel_2['manuf'].">Manufacturer</option>
  <option value='something' ".$sel_2['something'].">something else</option>
</select>
<input type='Submit' name='Submit' value='Resort'>
</form>");

?>
 
Oh.. by the way: sorry for not posting that code after locking the forum.. i just didnt have time to write it as i was busy adding download functionality to code tags, code syntax highlighting and line numbering..

however the code above might give you some better idea on what ive ment... one more thing.. I belive you shouldnt use DW for PHP coding..especially its buil-in functions and recordset statements: really hard to read and its more ASP style with them..

Try writing it by yourself as it will be faster: easier for you to modify and you will get a much better grap on quering..
 
I think my code is set up a bit different, but that doesn't matter. I can now get the year and make in the url to set up for the $_GET method but I'm recieving the error about LIMIT and SQL syntax. You can check it out here:
http://rs324.securehostserver.com/~parkciti/data/used_inventory.php
It will pull the year just fine but after pulling the make and trying to send both the year and make it pulls up the error message instead of selecting all used vehicles from the database where year = $_GET[year] and make = $_GET[make]. I'm stuck on where my syntax is going wrong. The variables $year, $make and $model will contain the values from the $_GET function.
Code:
<?php
if ((!$year) && (!$make) && (!$model)) {
	$maxRows_Recordset1 = 20;
} else {
	$maxRows_Recordset1 = 20;
}
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
		
$sqlorderby_Recordset1 = "make";
if (isset($sql_orderby)) {
  $sqlorderby_Recordset1 = (get_magic_quotes_gpc()) ? $sql_orderby : addslashes($sql_orderby);
}
mysql_select_db($database_myConnection, $myConnection);

if ((!$year) && (!$make) && (!$model) && (!$certified)) {
	$query_Recordset1 = sprintf("SELECT * FROM used_vehicle ORDER BY %s", $sqlorderby_Recordset1);
} else if ((!$make) && (!$model) && (!$certified)) {
	$query_Recordset1 = sprintf("SELECT * FROM used_vehicle WHERE year = '$year' ORDER BY make,model,body,ext_color", $sqlorderby_Recordset1);
} else if (($year != "") && ($model != "") && (!$certified)) {
	$query_Recordset1 = sprintf("SELECT * FROM used_vehicle WHERE year = '$year' OR make = '$make' ORDER BY make", $sqlorderby_Recordset1);
} else if ((!$year) && (!$make) && (!$certified)) {
	$query_Recordset1 = sprintf("SELECT * FROM used_vehicle WHERE year = '$year' OR make = '$make' OR model = '$model' ORDER BY body,year,ext_color", $sqlorderby_Recordset1);
} else if ((!$year) && (!$make) && (!$model)) {
	$query_Recordset1 = sprintf("SELECT * FROM used_vehicle WHERE certified = '1' ORDER BY web_price,make,model", $sqlorderby_Recordset1);
} 

$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $myConnection) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
?>
 
Some comment on your code: Register globals on: not good

The second one will be that you way use switch statement for that

the third willbe: simply populare the query dinamicaly:

Code:
<?php
$sql = "SELECT * FROM used_vechicles";

if(isset($_GET['year'])){
 $where_set=true;
 $sql.="WHERE year='".$_GET['year']."'";
}
if(isset($_GET['certified']){
  if($where_set){
     $sql.= " AND ";
  }else{
     $sql.= " WHERE ";
  }
  $sql.= "certified = '".$_GET['certified']."'";
}
?>
And so on.. i really dont have time to write the whole code.. byt you get the idea :D
 
I think I understand your dynamic query in the code but I dont understand what you are trying to say about switch statements?
What is wrong about having 'Register globals on'? I dont know enough about this to understand. Coudl you please explain. I will attempt your dynamic sql statement . Thanks
 
With register globals on, people could add GET variables to the URL to your script and set variables without you knowing. This means that if you forget to initialize a variable ANYWHERE in the script, you can instantly open up an exploit in your code.
 
Ok so how do you shut register globals off and if I shut them off does this effect the way in which I write code or anything else.
 
Well Register_globals = on allow code injections through forms and urls, which can affect and actually it DOES affect security of your codes.

Switch statement may be used so that you dont have to write tons of IF-ELSE statements
 
you shut them of in PHP.ini
find the line register_globals and set it to Off

It does affect your coding in a way... you will have to use $_GET['var_name'] to get URL variables
$_POST to get post variables, $_SESSION vor sessions, $_SERVER for server, $_ENV for enviromental and $_COOKIE for cookies
 
I'm using shared hosting so I dont' have control of the php.ini file unfortunatly. I already use the rul variables described so I wont have to figure that out all over again. As for the code you supplied on my issue I am not having any luck. Is there anyone out there that would like to get paid to do this? Yes, I'm willing to pay money if someone will just show me how this is done. I need the make selection in the form to be filtered from the query of the year selection. I need the model to be filtered down from the query of the year and the make, to help narrow the search for the vehicle the customer wants. I need each selection to filter in the appropriate vehicle and display a list of options in the repeat region below. Here is the url:
http://rs324.securehostserver.com/~parkciti/data/used_inventory.php
At this point I have wasted so much time it would just be more cost effective to pay someone to put this together. Any takers!
 
I've used Alexei's code but now my page comes up with a parse error. It tells me line 105 but I can't seem to figure out what exactly is causing the parse error.
Code:
<?php
 $query_Recordset1 = "SELECT * FROM used_vechicles ";

 if(isset($_GET['year'])){
  $where_set=true;
  $query_Recordset1.="WHERE year='".$_GET['year']."'";
 }
 if(isset($_GET['make']){
   if($where_set=true){
      $query_Recordset1.= " AND ";
   }else{
      $query_Recordset1.= " WHERE ";
   }
   $query_Recordset1.= "make = '".$_GET['make']."'";
 }
?>
 
Ok, so I've managed to get Alexei's code inserted into the page and to run. But now this version of the code gets the SQL sysntax error as soon as you select the year. with the error stating the check manual for right syntax to use near 'LIMIT 0,20' at line 1
Any ideas, anyone. I think we're making some headway. I think~!@
 
Back
Top