Jump to content

earl_dc10

Members
  • Posts

    71
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

earl_dc10's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. looks good, but Im a little confused why you want to shop off the end of $query [code] $query = substr($query,0,-1).") VALUES ("; [/code] also minor change [code] $query = substr($query,0,-1).") VALUES ("; for($i=0; $i<count($data); $i++) {     $query .= "'$fields[$i]',"; // for values should be $data[$i], correct? [/code] Thanks for the input!
  2. include doesn't necessarily display the data, it just, like it's name implies, includes its info into the current document and php is server code, it is parsed before it ever reaches the user, they can only see the output [code] <?php echo "<h1>Hello<h1>"; ?> //displays in web source code <h1>Hello<h1> [/code]
  3. Im creating an admin page where I can edit all of my tables and stuff like that. I use 1 form for everything and just apply it to seperate tables with radio buttons (selecting the different tables). anyway, if I want to add a new row or update a new row, I update the form with the number of text fields that correspond with the number of fields in the table, this is stored in an array. since the number of fields can vary, how would I right an Insert/Update query to accomodate that? I thought of having just 1 Insert and then the rest Update off of that Insert, but if I have 2 that are the same it would do both rows instead of the new one. Thanks! EDIT -> Inspiration just struck, but I'll ask anyway to see if there are any better ideas than mine this is my idea but we'll see what you come up with, since all my tables have id's I'll just insert the new id and run the updates off of that
  4. you could also do something similar to this : [code] if(empty($garage) || empty($cellar) || empty($garden) || empty($pool)) {    echo "Please fill all fields"; } [/code] if you don't like that you can just combine sford999 's code into a similar statement [code] if(($garage == "") || ($cellar == "") || ($garden == "") || ($poll == "")) {    echo "Please fill all fields"; } [/code]
  5. earl_dc10

    fwrite

    CHMOD is a fancy term for the permissions that you give a file
  6. ensure that your echo statement uses single quotes for the echoing ', if you have doubles " you'll need to do an escape slash [code] echo " <form action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\" name=\"input\"> [/code]
  7. are you echoing the form inside of php? if you are try this : [code] echo ' .... <form action="'.$_SERVER['PHP_SELF'].'" method="POST" name="input"> [/code] hope that helps!
  8. try this : [code] $query = "SELECT * from $db_table ORDER by $some_field DESC"; // don't have a LIMIT in it $select_query = mysql_query($query, $link)    or die("Couldn't select from $db_table ".mysql_error() ); $num_rows = mysql_num_rows($select_query); // gets number of rows [/code]
  9. if you want a realtime counter I would recommend javascript
  10. hi, try changing [code] <form method=POST name=input> [/code] to [code] <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST" name="input"> [/code]
  11. is it a problem? you could just use stripslashes() when you print the data from the table
  12. if you are deleting a row do this : [code] $query = "DELETE FROM $table WHERE $column = '$field_value'"; [/code] I believe DROP is used for removing Indexes, and deleting tables and databases P.S. double check your row values before deleting, this saved me alot of grief ;)
  13. try this [code] $sql = "UPDATE $table SET $field_name ='$new_entry' WHERE post_id = '$post_id' [/code] more on this at [a href=\"http://www.w3schools.com/sql/sql_update.asp\" target=\"_blank\"]http://www.w3schools.com/sql/sql_update.asp[/a]
  14. at every query add a die statement with an error [code] $select = "SELECT * FROM example"; $select_query = mysql_query($select, $link)    or die("Couldn't select from example".mysql_error() ); [/code] tell us what happens then
  15. [code] <input type="submit" id="sbt_results" value="Query"/> [/code] try changing "id" to "name" EDIT -> looks like I type too slow ;)
×
×
  • 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.