-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
i was going to say pretty much what they said... try: $comment = $_POST['comment']; $query = mysql_query("INSERT INTO comments (comment) VALUES ('{$comment}')"); if (!$query) { print 'MySQL Error: ' . mysql_error(); } else { print 'Comment: <strong>"' .$comment. '"</strong> entered successfully...'; }
-
try replacing the query line with this: mysql_query("INSERT INTO comments (comment) values ('{$comment}')") or die(mysql_error());
-
What error do you get? And what version of PHP are you running on your local web server?
-
Dont fully understand which bit you'd like help with? Adam
-
Think it works pretty much the same, not 100% but... while ($row = odbc_fetch_array($query)) { print 'Field 1: ' .$row[0]. ' Field 2: ' .$row[1]. '<br />'; }
-
By only checkin the username in the query you are still selecting that record, then having to do tests on the password field value to check if you actually needed the record. Quicker way round is to just add password to the query which then only returns records with the right username and password.. Making code neater, easier to understand and most likely saving some load time... If you've been getting an error did you try adding: mysql_query("...") or die( mysql_error() ); ??
-
If oyu mean a sort of true/false return from the mysql_query function you can use: $query = mysql_query("..."); if ($query) { ... } But to be honest I've found it a little unreliable in the past... If you don't mean that, then I don't know what you mean...
-
I'd say discomatt's ideas the best to go with.. Perhaps store the results in a database and then query it for files not matched to the original file list? So like a table called "original_filelist" and one called "used_files".... as you come across a reference to a file enter it into "used_files"... then obivouslly files in "original_filelist" without a match in "used_files" are unused files... Simple? Adam
-
probs better off doing it more like this.. $resource2 = mysql_query("SELECT * FROM users WHERE username='{$_POST['username']}' && password='{$_POST['password']}'"); if (mysql_num_rows($resource2) > 0) { print 'correct password!'; } else { print 'incorrect password!'; }
-
Ah yeah, to form an option of all the states.. foreach ($states['US'] as $state) print '<option value="' .$state. '">' .$states['US'][$state]. '</option>'; (Not checked) and to find the full title after selecting from database: $selectState = mysql_query("SELECT m_country, m_state FROM yourTable"); while ($stateRecord = mysql_fetch_assoc($selectState)) { if ($stateRecord['m_country'] == 'US') print 'US State: ' .$states['US'][ $stateRecord['m_state'] ]. '<br />'; } (Again not checked!) Adam
-
Look into sitemaps...
-
Well that can be quite complicated. Depends how you send the email in the script, would need to look into mail 'headers'... All email services like gmail and AOL have filters to try and filter out spam... I think sending a lot of emails at once probs won't help? Not sure, you'll probs learn from your experience... I don't know if gmail and that have limits... Adam
-
Help Needed With Syntax for Sending/Receiving Post Variables
Adam replied to fp2146's topic in PHP Coding Help
No they'll send the data to the POST array with their script... If they had sent the data to the GET array then there would be added values to the URL in the form of something like.. receivedata.php?something=this&somethingelse=that If thats what you were tryin to ask? Adam -
Could try something like: $highestID = 0; foreach($page['array'] as $c) { if ($c['id'] > $highestID) $highestID = $c['id']; } foreach($page['array'] as $c) { if ($c['id'] == $highestID) { echo 'some stuff'; } else { echo 'some other stuff'; } } It's not that efficient as it needs two loops, I dare say there's another way but.. I dont know it... Adam
-
Simple re-adjustable PHP forum that integrates nicely into existing DB
Adam replied to inVINCEable's topic in PHP Coding Help
why not just use phpBB then? or another? loads to choose from.. invision power board, vbulletin, etc. Just google it! -
Could you output the code from uriParser.php and main.inc.php ? Obviouslly if the value of them is just W need to seem whats happening when they're set.. Adam
-
I see your problem, but why does it sometimes return two kills? Which would you need to actually use in that case aswell? Adam
-
I assume your printing out the form in a loop? Well from what I can tell, although I cant see the start of the function, you seem to be printing </form> after the loop.. echo "</td> </tr>"; }// End No Items } echo "</table></form> <br />"; Try changing it to: echo "</form></td> </tr>"; }// End No Items } echo "</table> <br />";
-
Well it's not 'tabs', it's JavaScript and AJAX. If it requires the use of PHP you'll need to use AJAX to make a HTTP request, however if it doesn't you can just use JavaScript... Adam
-
Actually why not store them in the database too? Use a 'relational database'.. Google it..
-
how are they stored in the countries file ? do you have say.. AL=Alabama|NY=New York|...etc ?
-
How should I include my name as author with a class?
Adam replied to cgm225's topic in PHP Coding Help
to be honest i don't think it really matters that much. so long as people get the information it doesn't really matter what convention you use. I normally just use something neat and simple, for example: /************************************************/ // @Author: ########################### // @Script: ########################### // @License: ########################### /************************************************/ ... something just to put your mark on it. Add / remove them as you please. only reason i add the @ is purely from seeing so many scripts with it on, became somewhat of a habbit back in the early days after seeing so many scripts with it on... i don't know wether certain software recognises it or not but I can't imagine it really mattering that much... Adam -
yeah you'd basically have like a template of your dynamic content.. like : <table> <tr> <td><img src="<php print $record['imgSrc']; ?>" /></td> <td>Name: <?php print $record['name']; ?></td> </tr> .......... etc And basically the content would change varying what record you'd selected...
-
yeah just loop thru the array checking for a match... <?php $allowedFiles[0] = "example1.php"; $allowedFiles[1] = "example2.php"; $allowedFiles[2] = "example3.php"; $allowedFiles[3] = "example4.php"; foreach($allowedFiles as $val) { if ($_GET['fileToShow'] == $val) { highlight_file($val); } } ?> Not tested but should work...