Jump to content

Drummin

Members
  • Posts

    1,004
  • Joined

  • Last visited

Everything posted by Drummin

  1. Wouldn't limit do the job? $sql = "SELECT Dayset,Totrain FROM tablename WHERE TotRain>'20' LIMIT 3";
  2. I tend to make programs that interest me whether it's ever used or not. It's a good exercise for me. I have a version of this well underway. So if you don't find something you can make work let me know.
  3. There will be more to it than you might think. login system admin page/DB table(s) for entering/updating services, photo sizes etc. admin page for entering client accounts. (First and last name and email gathered from the event etc) admin page for images for each account. Move than likely you would use the client last and email gathered from the event to verify the user creating an account where they can then add a username and password for logging in to view images and placing orders. Once you have the support systems in place, the cart itself is pretty easy. Orders could be sent to you via email or viewed in the admin section. A simple interface could allow you to notify clients that their order is being processed, or is finished, again by email or if they login. --- Often people ask for a final "product" without realizing what all is needed to get the job done. If you need help send me a PM.
  4. if(isset($_GET['status']) && $_GET['status'] == "$status")
  5. Maybe I'm missing something, but how can GET and echo even be in the function showresults($conn) {}?
  6. Well I see both GET and POST are available on submit so I'm not sure what issue you are having. POST values Array ( [testpost] => ABC [submit] => test ) GET values Array ( [COUNTY_CODE] => maakondvalue [CITY_CODE] => city_codevalue [CITY_PART] => city_partvalue [sTREET] => tanavvalue [HOUSE_NUMBER] => majanumbervalue [show_on_company_page] => showoncompanypagevalue [show_house_number] => showhousenumbervalue [PLACENAME] => placenamevalue [CADASTRAL_NO] => cadastralnovalue [asukoht_vald] => asukohtvaldvalue [REAL_ESTATE_NO] => realestatenovalue [hidden_city] => hiddencityvalue [hidden_city_part] => hiddencitypartvalue [seller_name] => sellernamevalue [seller_phone] => sellerphonevalue [seller_email] => selleremailvalue [sPECIAL_OFFER_2_WEEK] => specialoffer2weekvalue [sPECIAL_OFFER_1_WEEK] => specialoffer1weekvalue [valid_thru] => validthruvalue [REO_VISIBLE] => reovisiblevalue [priority] => priorityvalue [broker1] => broker1value [broker2] => broker2value [popup_map_onload] => popupmaponloadvalue [MAP_PICTURE1_id] => mappicture1idvalue [MAP_PICTURE1_img] => mappicture1imgvalue [MAP_PICTURE1_map_area] => mappicture1mapareavalue [MAP_PICTURE1_map_point] => mappicture1mappointvalue ) Here's my sample test page. <?php echo "POST values<pre>"; print_r($_POST); echo "</pre>"; echo "GET values<pre>"; print_r($_GET); echo "</pre>"; $maakond="maakondvalue"; $city_code="city_codevalue"; $city_part="city_partvalue"; $tanav="tanavvalue"; $majanumber="majanumbervalue"; $showoncompanypage="showoncompanypagevalue"; $showhousenumber="showhousenumbervalue"; $placename="placenamevalue"; $cadastralno="cadastralnovalue"; $asukohtvald="asukohtvaldvalue"; $realestateno="realestatenovalue"; $hiddencity="hiddencityvalue"; $hiddencitypart="hiddencitypartvalue"; $sellername="sellernamevalue"; $sellerphone="sellerphonevalue"; $selleremail="selleremailvalue"; $specialoffer2week="specialoffer2weekvalue"; $specialoffer1week="specialoffer1weekvalue"; $validthru="validthruvalue"; $reovisible="reovisiblevalue"; $priority="priorityvalue"; $broker1="broker1value"; $broker2="broker2value"; $popupmaponload="popupmaponloadvalue"; $mappicture1id="mappicture1idvalue"; $mappicture1img="mappicture1imgvalue"; $mappicture1maparea="mappicture1mapareavalue"; $mappicture1mappoint="mappicture1mappointvalue"; echo "<form name=\"majaleht3\" id=\"majaleht3\" method=\"post\" action=\"test.php?COUNTY_CODE=$maakond&CITY_CODE=$city_code&CITY_PART=$city_part&STREET=$tanav&HOUSE_NUMBER=$majanumber&show_on_company_page=$showoncompanypage&show_house_number=$showhousenumber&PLACENAME=$placename&CADASTRAL_NO=$cadastralno&asukoht_vald=$asukohtvald&REAL_ESTATE_NO=$realestateno&hidden_city=$hiddencity&hidden_city_part=$hiddencitypart&seller_name=$sellername&seller_phone=$sellerphone&seller_email=$selleremail&SPECIAL_OFFER_2_WEEK=$specialoffer2week&SPECIAL_OFFER_1_WEEK=$specialoffer1week&valid_thru=$validthru&REO_VISIBLE=$reovisible&priority=$priority&broker1=$broker1&broker2=$broker2&popup_map_onload=$popupmaponload&MAP_PICTURE1_id=$mappicture1id&MAP_PICTURE1_img=$mappicture1img&MAP_PICTURE1_map_area=$mappicture1maparea&MAP_PICTURE1_map_point=$mappicture1mappoint\">"; echo "<input type=\"text\" name=\"testpost\" />"; echo "<input type=\"submit\" name=\"submit\" value=\"test\" />"; echo "</form>\r"; ?>
  7. Why not pass these past values as hidden fields instead of using GET?
  8. Note form field values and compare to DB field names. In your first post you listed DB field names as lower case. In my example I also made form field values lower case to match. You are also posting names as arrays by adding [] after the name, i.e. name="honda[]". Change to singular names, name="honda".
  9. Did you add the mysql_query to the filter string? Also be sure to change the name of the "tbl". <?php //add DB connection include("access.php"); //////////////////// if (isset($_POST['submit'])){ $values=array(); if (isset($_POST['honda'])){ $values[]= mysql_real_escape_string(trim($_POST['honda'])); } if (isset($_POST['toyota'])){ $values[]= mysql_real_escape_string(trim($_POST['toyota'])); } if (isset($_POST['mazda'])){ $values[]= mysql_real_escape_string(trim($_POST["mazda"])); } $sql = "SELECT * FROM tbl"; $filerby=implode("='yes' AND ",$values); $filerby.="='yes'"; if (count($values)>0){ $sql = "WHERE $filerby"; } $result = mysql_query($sql) or die (mysql_error()); while($row = mysql_fetch_array($result)) { // Print out the contents of each row echo "<br><hr>"; echo "Name:"; echo "{$row['name']}<br>"; echo "{$row['text']}<br>"; echo "<img src='".$row['image'] ."'>"."</a>"; echo "<br><br>"; echo "<a href='".$row['link']."'>".$row['link']."</a>"; echo "<br>"; } } ?>
  10. Anytime you wish to have "sticky posts", it's a good idea to post to the same page with processing at the top before <html>. Any reason why your results can't be on the same page as the form? As you're not POSTing back to the form, you can't really pick up the POST values can you. You could set posted values to session, then compare session values to your query array for the selected options if the back button is pressed. BTW, I didn't really notice you had type checkbox, in which case it should be selected="selected"
  11. Why not give your checkboxes a more reliable name like Chemicals? It's that the value you are sending anyway? name="Chemicals[]"
  12. <?php while($row = mysql_fetch_array($result)) { $checked={isset($_POST[$count]) && $_POST[$count]==$row['Chemicals'] ? 'checked="checked"' : ''); echo " <tr> <td><input type=checkbox name=".$count." value=".$row['Chemicals']." $checked /></td> <td>" . $row['Chemicals'] . "</td> <td>" . $row['Quantity'] . "</td> <td>" . $row['Location'] . "</td> <td>" . $row['Controlled'] . "</td> </tr> "; ?>
  13. Should have been concatenated on the WHERE section on my copy. $sql .= "WHERE $filerby"; Full update. <?php //add DB connection include("access.php"); //////////////////// if (isset($_POST['submit'])){ $values=array(); if (isset($_POST['honda'])){ $values[]= mysql_real_escape_string(trim($_POST['honda'])); } if (isset($_POST['toyota'])){ $values[]= mysql_real_escape_string(trim($_POST['toyota'])); } if (isset($_POST['mazda'])){ $values[]= mysql_real_escape_string(trim($_POST["mazda"])); } $sql = "SELECT * FROM tbl"; $filerby=implode("='yes' AND ",$values); $filerby.="='yes'"; if (count($values)>0){ $sql .= "WHERE $filerby"; } } ?>
  14. Not as nice as Pikachu2000's solution, but as I was typing out while he was posting, I thought I'd post it anyway. <?php //add DB connection include("access.php"); //////////////////// if (isset($_POST['submit'])){ $values=array(); if (isset($_POST['honda'])){ $values[]= mysql_real_escape_string(trim($_POST['honda'])); } if (isset($_POST['toyota'])){ $values[]= mysql_real_escape_string(trim($_POST['toyota'])); } if (isset($_POST['mazda'])){ $values[]= mysql_real_escape_string(trim($_POST["mazda"])); } $sql = "SELECT * FROM tbl"; $filerby=implode("='yes' AND ",$values); $filerby.="='yes'"; if (count($values)>0){ $sql = "WHERE $filerby"; } } ?> <html> <body> <form name="myform" action="" method="post"> Honda:<input type="checkbox" value="honda" name="honda"><br /> Toyota:<input type="checkbox" value="toyota" name="toyota"><br /> Mazda:<input type="checkbox" value="mazda" name="mazda"><br /> <input type="submit" value="submit" name="submit"> </form> </body> </html>
  15. Part of the problem may lie in the fact that you're posting these values as array's by adding [] after the name, eg name="honda[]". If the form fields are not looping through a list of records then just use a singular name, name="honda"
  16. Hey it's just me but I always do a check to see if it's a portrait or landscape then do re-size accordingly. <?php //Thumbs if ($height>$width){ $newheight=180; $newwidth=($width/$height)*$newheight; }else{ $newwidth=180; $newheight=($height/$width)*$newwidth; } $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); ?>
  17. I think it's the borders messing it up. Also being an image background, I think a width should be defined. Also 0 is not defined with px, just 0. You could try a padding of 1 OR a margin of -1. .navbar li{ text-align:left; margin:0 -1px; padding:0px; background-image:url('../img/highscores/derp.png'); background-repeat:repeat-y; border-right:1px solid black; border-left:1px solid black; }
  18. I just made one as PFMaBiSmAd suggested, so if you get stuck or want a copy, PM me.
  19. Well my example has the whole thing inside the isset statement as the query shouldn't be run anyway if the GET is not set and echoing result rows are not available.
  20. Are you sure about table and field names for example the "N" is uppercase in modelNo etc. Maybe attach an sql file of these two tables would help us spot an error.
  21. After running some tests, I don't see how the query is failing using the table(s) and field names shown. You have $oConn don't you? For my test I setup $oConn like so, name and password removed. <?php $host = "localhost"; //MySQL Database user name. $login = ""; //Password for MySQL. $dbpass = ""; //MySQL Database name. $dbn = "testdb1"; //Make connection to DB $oConn=mysql_connect("$host","$login","$dbpass") OR DIE ("There is a problem with the system. Please notify your system administrator." .mysql_error()); mysql_select_db($dbn,$oConn) OR DIE ("There is a problem with the system. Please notify your system administrator." .mysql_error()); ?>
  22. My bad. Should have used AND instead of WHERE. $SQLstmt = "SELECT m.modelName, m.modelID, m.modelNo, i.imageFile"; $SQLstmt .= " FROM tblModel as m"; $SQLstmt .= " LEFT JOIN tblImages as i"; $SQLstmt .= " ON m.modelID=i.modelID"; $SQLstmt .= " AND m.modelNo = $modno"; $db=mysql_query($SQLstmt,$oConn) or die(mysql_error());
  23. Does table tblModel have the fields modelName, modelID, modelNo? If not, adjust query. Does table tblImages have the fields modelID, imageFile? If not, adjust query. Also is the field modelNo in the tblModel table an integer or varchar type field? IF varchar, put condition variable in single quotes. $SQLstmt .= " WHERE m.modelNo = '$modno'";
  24. Looking at your full code, I see you have the code in question in an open table cell. <table width="100%" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="81%" valign="top"> So in both the IF results found, and no results found, you're going to want am opening table tag. Very hard to tell with all the nested tables but it looks like you have a closing table tag for this section. Again not sure.
×
×
  • 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.