Jump to content

PHP Monkeh

Members
  • 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

Newbie (1/5)

0

Reputation

  1. Quite easily, change your foreach() line to this: foreach($Data as $key => $var) That will allow you to use $key.
  2. That's some pretty awful design, but the error probably lies in the ret11() function.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. Though you marked the topic as solved, you could always look at using sessions.
  8. Gotcha, look into multipart emails - there are quite a few tutorials from a google search for 'php multipart emails'
  9. Haven't tested or used, but found: http://www.getid3.org/
  10. 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.
  11. I don't know how to do it personally, but look in to PayPal's IPN (Instant Payment Notification).
  12. 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).
  13. 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?
  14. 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).
  15. I take it the form which is submitting this data: a) is using the POST method and b) has a field named 'submit'
×
×
  • 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.