
datoshway
Members-
Posts
101 -
Joined
-
Last visited
Everything posted by datoshway
-
Sure thing. Below is my full query. This is for a detail page on a real estate website. So if boolActivate=0 then the property should not display anything. $strQuery = sprintf( "SELECT p.*, a.strAreaName FROM tblProperties p LEFT JOIN tblAreas a ON p.intAreaID = a.intID WHERE p.intID = %d AND p.boolActivate = 1", intval($intPropertyID)); $queryGetProperty = $objDatabase->query($strQuery); if ($objDatabase->num_rows($queryGetProperty) > 0) { $arrRow = $objDatabase->fetch_assoc($queryGetProperty); extract($arrRow); if (strlen($dtDateAvailable) > 0) { $dtDateAvailable = date("m/d/y", strtotime($dtDateAvailable)); } if (strlen($dtDateAvailableSummer) > 0) { $dtDateAvailable = date("m/d/y", strtotime($dtDateAvailableSummer)); } if (strlen($dtDateAvailableWinter) > 0) { $dtDateAvailable = date("m/d/y", strtotime($dtDateAvailableWinter)); } } $objDatabase->free_result($queryGetProperty); $strQuery = sprintf( "SELECT * FROM tblPropertiesPhotos WHERE intPropertyID = %d", intval($intPropertyID)); $queryGetPhotos = $objDatabase->query($strQuery); Below is a sample echo on the page for part of the content. <?php if (($dblPriceYearly > 0) && (strlen($dtDateAvailable) > 0)) { echo date("m/d/y", strtotime($dtDateAvailable)) . " (Y) "; } if (($dblPriceSummer > 0) && (strlen($dtDateAvailableSummer) > 0)) { echo date("m/d/y", strtotime($dtDateAvailableSummer)) . " (S) "; } if (($dblPriceWinter > 0) && (strlen($dtDateAvailableWinter) > 0)) { echo date("m/d/y", strtotime($dtDateAvailableWinter)) . " (W)"; } ?> What i'm getting is a detail page with all the relaivant info. I am looking for it to error out and not display any info just as it would if you went to the page and put in an incorrect ?=ID
-
It's not in my query. The problem is when I put it in the query like: $strQuery = sprintf( "SELECT p.*, a.strAreaName FROM tblProperties p LEFT JOIN tblAreas a ON p.intAreaID = a.intID WHERE p.intID = %d AND p.boolActivate = 1", intval($intPropertyID)); it doesn't work.
-
Below is my query, I have a column called boolActivate in my tblProperties table but I can't figure out how to put in a where clause so it reads something like WHERE boolActivate = 1 $strQuery = sprintf( "SELECT p.*, a.strAreaName FROM tblProperties p LEFT JOIN tblAreas a ON p.intAreaID = a.intID WHERE p.intID = %d", intval($intPropertyID)); Using MYSQL 5
-
-
Seems to be working just fine in Safari but in Chrome and Firefox i'm getting the attached results. Below is my code along with css. Looking for some help. Thanks! .item { width: 286px; margin: 0 0 30px 20px; float: left; height: 250px; line-height:340px; text-align:center; border:1px solid #000; } .item img { opacity:0; vertical-align: middle; } <div class="item"> <img src="_images/_content/logos/<?php echo $intID; ?>/<?php echo $strFilename; ?>" > </div>
-
So I need to build into a PHP/MYSQL system I currently have a way for admins to see a list of things done through the CMS by all users. Any ideas?
-
Thank you! For some reason i'm only getting two results from one table with that query. There should be 3 results if we were getting data from both tables. Below is my full code. Any ideas on where the snag might be? $strQuery = "SELECT * FROM tblDocuments INNER JOIN tblCleaning ON ( tblCleaning.strMessage = tblDocuments.strMessage ) ORDER BY tblDocuments.dtAdded DESC"; $queryGetNews = db_query($strQuery); <?php if (db_num_rows($queryGetNews) > 0) { while ($objRow = db_fetch_object($queryGetNews)) { $intRowID = intval($objRow->intID); $strRowName = stripslashes($objRow->strHeadline); $strMessage = stripslashes($objRow->strMessage); $dtAdded = date("m/d/Y", strtotime($objRow->dtAdded)); ?> <div id="messages" style="border:1px solid #999; width:430px; height:26px; line-height:26px; margin-bottom:3px; padding-left:5px;"><?php echo $dtAdded; ?> - <?php echo $strMessage; ?></div> <?php } db_free_result($queryGetNews); } ?>
-
The related column is strMessage. Basically need to pull strMessage from both tables.
-
Below is my code, not working, seems to be displaying both even if boolType=1 <?php if ($boolType == 1) { echo 'Go'; } else { echo 'Fail'; } ?>
-
The following is querying one table. I need this to query two tables and display the results. $strQuery = "SELECT * FROM tblDocuments ORDER BY dtAdded DESC"; $queryGetNews = db_query($strQuery);
-
Nevermind I got to the bottom of it. Just needed group by c.intID
-
I'm not sure why i'm getting duplicate results with this query, any ideas by the look of it? $strQuery = "SELECT d.intCityID, d.strClinicDate, c.strName, c.boolPastEvent, c.boolClosed FROM tblCitiesDates d LEFT JOIN tblCities c ON d.intCityID = c.intID ORDER BY d.intCityID ASC";
-
Anyone? I think all that needs to happen is we need to take users from https to http. However we already have a 301 redirect happening. Below is what I have Redirect 301 / http://www.newwebsite.com/ I tried the following: Options +FollowSymlinks RewriteEngine on RewriteCond %{SERVER_PORT} ^443$ RewriteRule ^(.*)$ http://www.oldwebsite.com/$1 [R=301,L] The redirect works fine but still getting a error when visiting the https version. Please help!
-
Here is the issue i'm having I used a 301 redirect in htaccess to redirect a site that previously was a https. Links from google point to https. The problem is users are getting a warning message when clicking on https links from google before the 301 kicks in because the old domain is not longer ssl'ed. What to do? Thanks in advance
-
Got it, never mind, it should look like; mysql_real_escape_string($_POST['Statement'])
-
How would you recommend setting that up based on the code I posted?
-
For some crazy reason if any of my entries in the form fields have an Apostrophe in it, the data record is not recorded. Any ideas on a fix? Here is the code that deals with the database insert on my process file. $db_host = "localhost"; $db_user = "XXX";$db_pass = "XXX";$db_name = "XXX";$db_table = "XXX"; $link = mysql_connect($db_host,$db_user,$db_pass); if(!$link) die ('Could not connect to database: '.mysql_error()); mysql_select_db($db_name,$link); $query = "INSERT into `XXX` (Name,Address,CityStateZip,Phone,School,SchoolAddress,Grade,Subject,Statement,Brand,Vendor,Referral,Age,Gender,Email) VALUES ('" . $_POST['Name'] . "','" . $_POST['Address'] . "','" . $_POST['CityStateZip'] . "','" . $_POST['Phone'] . "','" . $_POST['School'] . "','" . $_POST['SchoolAddress'] . "','" . $_POST['Grade'] . "','" . $_POST['Subject'] . "','" . $_POST['Statement'] . "','" . $_POST['Brand'] . "','" . $_POST['Vendor'] . "','" . $_POST['Referral'] . "','" . $_POST['Age'] . "','" . $_POST['Gender'] . "','" . $_POST['Email'] . "')"; mysql_query($query); mysql_close($link); }
-
No go. Now it doesn't submit the form if it's duplicate but still takes me to the thank you page. Could it be because the thank you page is defined in the js file? Here is the js file code that handles that. $(".TTWForm").validator({effect:'labelMate'}).submit(function(e){ var form = $(this), checkRadioValidation = validateCheckRadio(); if(!e.isDefaultPrevented() && checkRadioValidation){ $.post(form.attr('action'), form.serialize(), function(data){ data = $.parseJSON(data); if(data.status == 'success'){ form.fadeOut('fast', function(){ window.location="thanks.php"; }); } else validator.invalidate(data.errors); }); }
-
Thank you so much for checking that out and making some adjustments. The code works in preventing the entry but not echoing anything on the front end. Any ideas?
-
Hello guys! I need some help adding some validation to my php form. I need have this check to see if there is already an entry in the database otherwise throw a error or even better just forward the user to a error page. Here is my foundation process code in my process file that inserts the data and emails it out. Thanks in advance! function process() { $msg = "<strong>Registration Details</strong>: <br /> <br /> \n\n"; foreach($this->fields as $key => $field) $msg .= "<strong style='color:#666;'>$key</strong>: $field \n <br />"; $to = '[email protected]'; $subject = "Subject Line"; $from = "[email protected]"; mail($to, $subject, $msg, "Content-type:text/html;charset=utf-8\r\nFrom: $from\r\nReply-To: $from\r\nReturn-Path: $from\r\n"); mail($_POST['Contact'], $subject, '<html> <div style="background-color: #FFF; color: #536d86; margin-left:10px; height:1000px; font-size:15px; margin:0px; padding:0px; font-family: Arial, Helvetica, sans-serif;"><a href="http://XXX.com/"><img border="0" src="http://XXX.com/thanks.jpg" /></a><br />'. "$msg </div> </html>", "Content-type:text/html;charset=utf-8\r\nFrom: $from\r\nReply-To: $from\r\nReturn-Path: $from\r\n"); $db_host = "localhost"; $db_user = "XXX";$db_pass = "XXX";$db_name = "XXX";$db_table = "entries"; $link = mysql_connect($db_host,$db_user,$db_pass); if(!$link) die ('Could not connect to database: '.mysql_error()); mysql_select_db($db_name,$link); $query = "INSERT into `entries` (Hull,Location,Contact) VALUES ('" . $_POST['Hull'] . "','" . $_POST['Location'] . "','" . $_POST['Contact'] . "')"; mysql_query($query); mysql_close($link); } function set_error($field, $rule) { if ($this->is_xhr) { $this->error_list[$field] = $this->error_messages[$rule]; } else $this->error_list .= "<div class='error'>$field: " . $this->error_messages[$rule] . "</div>"; }
-
Fugix, thank you thank you thank you! Worked perfect. Simple solution. Love it. Thanks again.
-
Hey guys. I have results like A1, B4, C19, C35, d22, etc etc. How can I have my results just sort in order of first letter then number so all the A's would be grouped etc etc.
-
This looks like it's going to simply replace the words, all I need to do is exclude the whole result (row) if any of those words exist in the Message Column..
-
Ok so I thought I had it but not so much. It works with just one word (crap), if I add more then one word (crap,suck) then it doesn't work. Any ideas?? Here is the full query.. $Bad_Words = "crap"; $strQuery = "select * from Comments where Message NOT LIKE '%$Bad_Words%' order by dtAdded desc"; $queryGetComments = mysql_query($strQuery) or die(mysql_error());