-
Posts
409 -
Joined
-
Last visited
Never
About PHP Monkeh
- Birthday 08/06/1988
Contact Methods
-
Website URL
http://www.legacydesign.co.uk
Profile Information
-
Gender
Not Telling
-
Location
United Kingdom
PHP Monkeh's Achievements
Newbie (1/5)
0
Reputation
-
Quite easily, change your foreach() line to this: foreach($Data as $key => $var) That will allow you to use $key.
-
That's some pretty awful design, but the error probably lies in the ret11() function.
-
Best method of incorporating a flagging system?
PHP Monkeh replied to Modernvox's topic in PHP Coding Help
Alright well you'll need to do a bit more work for the second option, but here's the rough outline: 1) Create a new 'flags' table with the fields: id, venueId, userId, reason I hope your venues table has an ID field as you'll need something to uniquely identify it. 2) Set up your page to allow visitors to flag up a venue and specify which reason 3) Do some checking once the user has submitted the flag: do a query on the venueId, and current user's ID, and make sure that there isn't a row in the 'flags' table containing both. If the check passes, then submit the flag to the table and you're done (this handles re-submissions from the same user for the same venue). 4) As for your CRON script, you'll probably need to use a JOIN if you want to do it pure MySQL (and I must admit I'm hopeless with JOINs). Or if you wanted to do it with some PHP: $query = "SELECT id, COUNT(*) FROM `flags` GROUP BY `id`"; Loop through that query, check whether COUNT(*) is greater than or equal to 5 and then perform another query to delete the row. Not going to write the code for you, but that should at least get you on the right track. -
Primary Key A primary key is an auto-incrementing number which is unique to each row of the database table. It allows you to uniquely identify each row, as other values may change. )";//do I need to remover the ; what is the purpose of that? just wondering because my book examples have them I didn't mean that line of code, I meant the entire variable. It's called $slq rather than $sql, and I wondered whether you changed the name of it so that it wasn't used. $result=mysql_query ($sql, $connection)//isn't this the $result variable? It is, but your if() statement is looking for $results.
-
Best method of incorporating a flagging system?
PHP Monkeh replied to Modernvox's topic in PHP Coding Help
There are two routes you can go down, either adding another field to the table you current have, or creating a new table specifically for storing 'flags'. Considering you only want to know if there are 5 flags, and not extra info like date/time submission of flag, who flagged it up, their reason etc, I'd go with the extra field option. So: 1) Add another field to your current table called 'flags' 2) Set up your page so that the user can add 1 to this flag field, you might want to use sessions/cookies to prevent multiple submissions - though if you're afraid of abuse you may wish to go with the 2nd option I suggested above 3) Create a script (which the CRON will call) that does a query on all rows which have a 'flag' value of 5 or more, and delete them The second option will be a bit more complex, if the above isn't what you were looking for I can go in to more detail. -
I'm trying to figure out whether this is a joke or not. Anyway, you'll need to show us some actual code if you want us to help. There's no use mentioning that something is in an 'endless loop', when the code you've shown doesn't actually contain a loop. And please spell-check your posts before posting as they're hard to understand.
-
Though you marked the topic as solved, you could always look at using sessions.
-
Gotcha, look into multipart emails - there are quite a few tutorials from a google search for 'php multipart emails'
-
Haven't tested or used, but found: http://www.getid3.org/
-
If you want to see all your errors, remove your error supressions (@ symbol) from the beginning of function calls. I'll give you a hint though, there are quite a few. Just to point out the ones I spotted: <?php $sql="CREATE database hombudget"; $connection= @mysql_connect ("localhost","spike", "9sj7En4") or die (mysql_error()); $result=@mysqlquery ($sql, $connection) or die (mysql_error()); mysql_select_db("homebudget", $connection) $tbl= "CREATE TABLE 'estimate' ( Category varchar (10), Description varchar (30), Budget int )"; // You might want a primary key $slq = " DROP DATABASE IF EXIST 'homebudget' CREATE TABLE 'expenses' ( Category varchar (10), espenseData DATE, expenditure INT )"; // Did you leave this in intentionally? $result=mysql_query (4sql, $connection) // 4 rather than $ sign or die (mysql_error()); if ($results) { // Variable doesn't exist $msg = "</P>Database Homebudgethas been created </P>"; // Where's the beginning P tag? } ?> <HTML> <HEAD> <TITLE>Homebudget Database</TITLE> </HEAD> <BODY> <?php echo "$msg"; // No need for quotation marks here ?> </BODY> </HTML> Quite frankly without trying to sound rude, it's quite a mess in there.
-
I don't know how to do it personally, but look in to PayPal's IPN (Instant Payment Notification).
-
If you want to know whether the user can read HTML emails, the only way to do that is to ask them (it's common to ask whether the user wants HTML/Plain Text emails).
-
Alright so you want to do it without MySQL, that's fair enough. So where do you want this data to be coming from that you're matching up? Text file? External web-page? Embedded in the code?
-
Execute SQL and display data on Submit click
PHP Monkeh replied to gabriellevierneza's topic in PHP Coding Help
Put it anywhere on the page which is handling the form submission, as it will show you what the $_POST array contains (and so you can see if 'submit' is in there). -
Execute SQL and display data on Submit click
PHP Monkeh replied to gabriellevierneza's topic in PHP Coding Help
I take it the form which is submitting this data: a) is using the POST method and b) has a field named 'submit'