-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
You really don't want to spend time making this one-at-a-time query. Very resource intensive which you don't want to do. I appreciate that you want to have a class, but why not write the query outside of the class and pass the string var containing it? For the arguments you have it right - create an array and pass it to the function doing the execute or the prepare.
-
How to make this database relation system
ginerjm replied to entheologist's topic in Application Design
Methinks you are in the wrong forum -
We could help you jump off a bridge as well. Would you like that? Your ideas are completely mal-formed and your intent is only going to reap havoc for you. No - we won't help you do that to yourself. You are committing technical suicide.
-
Why is binary mode missing from fopen() modes?
ginerjm replied to johnmerlino1's topic in PHP Coding Help
It's been explained twice to you. If your entire question is simply curiosity about the option, then you won't get anymore here. And if your concern is about the accuracy of the manual, well then, you are going to have a field day with other functions. Signing off - too boring. -
Distinct AND Group By have LONG delay, return nothing.
ginerjm replied to njdubois's topic in PHP Coding Help
I took the liberty of cleaning up your code. I firmly believe that using long var names and mixed cases is the problem with many coding errors. Hence this: <?php error_reporting(E_ALL | E_NOTICE); // Kinds of errors to show ini_set('display_errors', '1'); // turn on display at the client to display the messages $con = mysql_connect($host,"marcomdata",$password); if (!$con) { die('Could not connect: ' . mysql_error()); } if (!mysql_select_db("marcomdata", $con)) die("Could not select db: " . mysql_error(); $sql = "SELECT year FROM car_make GROUP BY year ORDER BY year DESC "; echo $sql . '<br />'; // run the query and check if it succeeds $qresults = mysql_query($sql); if (!$qresults) die("Query failed - ".mysql_error(); // begin building select tag // NOTE - I removed semis from your function calls $year_html = '<select id="year" name="year" onchange="do_Auto(this.name,this.value)" onfocus="clear_state(this.name)" onblur="saveData(this.name,this.value)">'; $cur_car_year=""; // This line is given a value in another place. if($cur_car_year=='') { $year_html.='<option></option>'; } // loop thru query results and build options while ($row = mysql_fetch_array($qresults)) { if ($row['year'] == $cur_car_year) { $year_html .= '<option selected>'.$row['year'].'</option>'; } else { $year_html .= '<option>'.$row['year'].'</option>'; } } $year_html .= '</select>'; mysql_close($con); echo $year_html; ?> Note the altered names. I do not see anything here that would cause your sql connection to time out. However I do see a problem with your options since none of them have a value so how are you going to analyze what the user clicks on? I also added an error check DIRECTLY after your db select and query calls. One must do this kind of thing all the time. -
Why is binary mode missing from fopen() modes?
ginerjm replied to johnmerlino1's topic in PHP Coding Help
Read the manual and decide for yourself. -
Form: $_POST 2 values from each checkbox and button
ginerjm replied to FreshCat's topic in PHP Coding Help
Sorry . Don't know what you really want. Try again? Perhaps you need to create array to hold your 'value' possibilities as keys and a sub-array with the desc and cost and then in your php you take the phone[] element and grab it out of the array to get your info.? -
Distinct AND Group By have LONG delay, return nothing.
ginerjm replied to njdubois's topic in PHP Coding Help
Where does it return false? I don't see how you handle the 'false' condition of that if (which I missed before). You're not sure if error checking is on? Can you check that and make sure you are getting all Notices and All errors? -
Distinct AND Group By have LONG delay, return nothing.
ginerjm replied to njdubois's topic in PHP Coding Help
I say this over and over again - Turn On PHP Error Checking. Also - what do you mean by 'it returns false'? What line is that coming from? Try testing your query result to see if it failed or not. -
Throw in some echos of your mail variables to be sure that a) you are getting to that line and b) that the vars have the proper content/format
-
Why is binary mode missing from fopen() modes?
ginerjm replied to johnmerlino1's topic in PHP Coding Help
Same for the 't' mode. I think it is because there are so many caveats mentioned in the comments that one needs to be "more" aware of how and why to use both 'b' and 't' mode. -
Count Facebook shares and display in a text form?
ginerjm replied to sphinx's topic in PHP Coding Help
Is your question concerning how to do this or how to use a certain font? -
David - I wasn't suggesting that the initial checkboxes be created from POST data. As I showed - they are created manually. They could be created via a query that pulls down 'value' items and 'literal' skill names to be used in the html, but I left that to the OP's imagination and skill level
-
Checkboxes work by assigning ALL of them the same 'name=' attribute. Your html for a checkbox would look like: <input type='checkbox' name='skills[]' value='1'><label> Skill 1</label> <input type='checkbox' name='skills[]' value='2'><label> Skill 2</label> Create as many of these as you need with each having a unique value attribute and label. Then in your php code you will create a loop to go thru the returned $_POST elements that will be in the 'name' index in an array. $invalid_skill = false; $have_skills=false; foreach ($_POST['skill'] as $skill) { if (!in_array($skill,array(1,2,3,4,5))) { $invalid_skill=true; } else { $have_skills = true; } } if (!$invalid_skill) { $err_msg = "You have an invalid skill";// user hacked the form and produced something wrong } if (!$have_skills) { $err_msg = "You must provide a skill"; } Of course you can use the literal value of the skills in the value clauses instead of a number, but I think this gives you something to work with. Hope to see your code attempt soon!
-
If you want to produce an output of unknown layers such as you described, recursion is the only way to handle it that I know of. I don't think you can build a query to produce a complete set of data where you have an unknown number of generations to map.
-
Would be a good place to write a recursive function. Read up on them for some examples. Be sure to rely on local vars passed as arguments to the function and also have a bit of logic to handle the amount of spaces (?) you want to use to indent each lower nest of results or to un-indent once done with a nest/level PS - be sure to set your execution time in your php.ini file to something very very small while developing this. I'd suggest one second..
-
Making a PHP script non accessible to traffic
ginerjm replied to Nickmadd's topic in PHP Coding Help
I always specify absolute paths for things that I know are not going to move. That way they are always 'found'. I don't see it as a problem. In my std. startup logic I always set a couple of vars to be used for this purpose. This logic is included in my scripts, so should I EVER NEED to modify my paths, it's a simple change. If your task is going to reference files that are expected in some odd folder name or under some folder name, simply specify the absolute path to that folder or parent and work from there. One doesn't HAVE to rely on php's search methodology to find things.... -
FloorPuzzles is undefined. It is nothing but an error waiting to be revealed when you turn on php error checking. Whatever do you think it is? It is NOT a php variable. It is not a constant. It is not a string. It is a set of ascii characters that mean nothing to the php interpreter and therefore will show you an error message.
-
If you can sit there and write words like your above post I have no interest in helping you learn to develop code. This has to be the absolute stupidest thing I have every heard from someone involved in IT (notice I didn't say 'programmer' since you aren't).
-
Turn on php error checking and do a simple test on the results of your query and you should see an error or two. Your first query statement is flawed. What is FloorPuzzles ? You have this undefined string of characters hung in the middle of your query. That won't execute. And, really? You are burying your info (data) on a product in your script instead of a db table? Really?
-
Dont' duplicate data in your db. Ie, remove fullname. Then do you queries with where last_name = ?? and first_name=?? or last_name=?? to get something close to the first/last name desired.
-
Maybe you need to do some learning and then try some coding? This code: while ($hs_show = mysql_fetch_array($sql)) { $urut++; $marqueeText = $hs_show['judul']; // build single text string ?> <marquee scrollamount="4" align="left" behavior="scroll" direction="left" class="text" onmouseover="this.stop()" onmouseout="this.start()"> <?php echo $marqueeText; ?> </marquee> <?php } is very silly. You are looping thru your result records and creating a 'marquee' tag for every record. Is that what you want? As was said before - REMOVE THE MARQUEE TAG from the loop. Create just your text and then use that combined text in a var in your single marguee tag later. Also - stop using the MySQL_* functions. IF you bothered to read the manual you would see why. Here is a better method: $marqueeText = ''; while($hs_show = mysql_fetch_array($sql)) { $urut++; $marqueeText .= $hs_show['judul']; // build single text string } echo '<marquee scrollamount="4" align="left" behavior="scroll" direction="left" class="text" onmouseover="this.stop()" onmouseout="this.start()">', $marqueeText, '</marquee>';
-
So you are not a programmer yet you "have" this script. It allows one to upload any type of file? Really? Are you concerned about what files may be uploaded by this script? Is the 'uploads' folder outside of your web tree (if you know what that means)? Have you analyzed the risks that this script may be creating for you? So many things that could go wrong that a programmer would understand and ensure (hopefully) against. Perhaps you should decide if you want this or if you want someone else to do it for you since you obviously have a website that could be at great risk here.
-
Add the following to the beginning of your php script: error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); This will display any errors happening that prevent the browser from showing the page.
-
Turn on php error checking in the offending script and then tell us what you get