Jump to content

Swerve1000

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Swerve1000's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you sir.! Fixed!! As for the 'Do', I do not know, the tutorials saying were using it to keep displaying result rows until none are left in the variable $row which contains all the data.
  2. Hi, I'm following a tutorial and am having trouble with one line of my code:- <td>year_promoted</td> <td>promotor</td> <td>students</td> </tr> <?php do ( ?> <--------------ERROR ON THIS LINE (line 42) <tr> <td><?php echo $row['id']; ?> </td> <td><?php echo $row['first_name']; ?></td> <td><?php echo $row['last_name']; ?></td> <td><?php echo $row['nickname']; ?></td> <td><?php echo $row['belt']; ?></td> <td><?php echo $row['belt_rank']; ?></td> <td><?php echo $row['country']; ?></td> <td><?php echo $row['year_promoted']; ?></td> <td><?php echo $row['promotor']; ?></td> <td><?php echo $row['students']; ?></td> </tr> <?php )while ($row = mysql_fetch_array($result)); ?> </table> </body> </html> --------------------------------------------------------------------------- The error I get is:- Parse error: syntax error, unexpected ';' in C:\wamp\www\results.php on line 42 This is how the guy has the code in the tutorial and it works for him, but is failing to run for me. It's use to to keep creating rows in a table until all results are displayed on that table. I'm stuck
  3. You mean SQL queries to get the data from the database I think, going to use PHPMyAdmin to create the SQL, just need to sort my PHP out. THanks!
  4. Hi, Don't want to store anything, just want a user's search results to show the matching rows on a page.
  5. thanks for the great help! So to view the results, I need to create a webpage called 'searchresults.php' and use some php code to place the results into the results page form, right? Such as ECHO or something I'm guessing Thanks!
  6. Hi, I'm trying to create a webpage form which will query a database and post the results onto a webpage. I'm trying to write the code for the form:- Can anyone tell me what the id 'thing/value' is/does? I need to use this I'm guessing for the SQL query. I need to go through all of this stage by stage. Many thanks!
  7. I'm using Dreamweaver and want to make a php page to query a MySQL database but I don't comprehend how they are supposed to fit together I have the php script:- mysql_connect('server', 'userName', 'password'); mysql_select_db('dbname'); to insert data: mysql_query("insert into tableName(field1, field2, ...) values('$value1', '$value2', ...)"); to update data: mysql_query("update tableName set field1='$value1', field2='$value2', ... where primaryKey=$rowId"); and I have the MySQL tables made, but how do I add the php script to the webpage? Thanks!
  8. No sir, the username/password account holders will not be on the database except for they need to have access to gain access to the form to allow them to add/modify data. I just both don't get the whole separate table issue and why it's important, and how to use them at present.
  9. Hi PHPFreaks, I'm currently trying to design my first project, and would some advice on how best to do it. I am creating a one tabled MySQL database and want to create two forms, the first will be to allow users to retrieve data from the database, and have it display in a structured way, with, the first form on that resulting page so to allow them to perform another search in the same manner as the first. The second form will be username/password protected and on a different URL, to be used by staff to enter/modify data on the database. That's basically it, My present plan is to create the MySQL database through PHPMyAdmin, and create the forms through Dreamweaver MX/PHP. Could you be as to kind as to offer me some advice on how best to go about this, and how to keep it as simple as possible? My main concern is the second username/password protected form - Will I need to create other columns on the table to hold this information and will having it on the same table create security issues? I really want to avoid having more than one table, as my knowledge isn't up to dealing with this at present. Many thanks.
  10. Wow, speedy reply! thanks. So ALL numbers have nothing to do with just this section of the code (below) which just describes the movie types? $type = "INSERT INTO movietype (movietype_id, movietype_label) " . "VALUES (1,'Sci Fi'), " . "(2, 'Drama'), " . "(3, 'Adventure'), " . "(4, 'War'), " . "(5, 'Comedy'), " . "(6, 'Horror'), " . "(7, 'Action'), " . "(8, 'Kids')" ; Thanks to both of you for such great replies
  11. Hi, I'm doing a tutorial from a PHP/MySQL book I bought and am unable to understand 1 piece of the code. This is the first file which creates the database and it's tables:- <?php //connect to MySQL; note we’ve used our own parameters- you should use //your own for hostname, user, and password $connect = mysql_connect("localhost", "bp5am", "bp5ampass") or die ("Hey loser, check your server connection."); //create the main database if it doesn't already exist $create = mysql_query("CREATE DATABASE IF NOT EXISTS moviesite") or die(mysql_error()); //make sure our recently created database is the active one mysql_select_db("moviesite"); //create "movie" table $movie = "CREATE TABLE movie ( movie_id int(11) NOT NULL auto_increment, movie_name varchar(255) NOT NULL, movie_type tinyint(2) NOT NULL default 0, movie_year int(4) NOT NULL default 0, movie_leadactor int(11) NOT NULL default 0, movie_director int(11) NOT NULL default 0, PRIMARY KEY (movie_id), KEY movie_type (movie_type,movie_year) )"; $results = mysql_query($movie) or die (mysql_error()); //create "movietype" table $movietype = "CREATE TABLE movietype ( movietype_id int(11) NOT NULL auto_increment, movietype_label varchar(100) NOT NULL, PRIMARY KEY (movietype_id) )"; $results = mysql_query($movietype) or die(mysql_error()); //create "people" table $people = "CREATE TABLE people ( people_id int(11) NOT NULL auto_increment, people_fullname varchar(255) NOT NULL, people_isactor tinyint(1) NOT NULL default 0, people_isdirector tinyint(1) NOT NULL default 0, PRIMARY KEY (people_id) )"; $results = mysql_query($people) or die(mysql_error()); echo "Movie Database successfully created!"; ?> This the second file, it inserts data into the tables/fields created in the first file:- <?php //connect to MySQL $connect = mysql_connect("localhost", "bp5am", "bp5ampass") or die ("Hey loser, check your server connection."); make sure we're using the right database mysql_select_db("moviesite"); XXX insert data into "movie" table XXX $insert = "INSERT INTO movie (movie_id, movie_name, movie_type, " . XXX "movie_year, movie_leadactor, movie_director) " . XXX "VALUES (1, 'Bruce Almighty', 5, 2003, 1, 2), " . XXX "(2, 'Office Space', 5, 1999, 5, 6), " . XXX "(3, 'Grand Canyon', 2, 1991, 4, 3)"; XXX $results = mysql_query($insert) or die(mysql_error()); //insert data into "movietype" table $type = "INSERT INTO movietype (movietype_id, movietype_label) " . "VALUES (1,'Sci Fi'), " . "(2, 'Drama'), " . "(3, 'Adventure'), " . "(4, 'War'), " . "(5, 'Comedy'), " . "(6, 'Horror'), " . "(7, 'Action'), " . "(8, 'Kids')" ; $results = mysql_query($type) or die(mysql_error()); //insert data into "people" table XXX $people = "INSERT INTO people (people_id, people_fullname, " . XXX "people_isactor, people_isdirector) " . XXX "VALUES (1, 'Jim Carrey', 1, 0), " . XXX "(2, 'Tom Shadyac', 0, 1), " . XXX "(3, 'Lawrence Kasdan', 0, 1), " . XXX "(4, 'Kevin Kline', 1, 0), " . XXX "(5, 'Ron Livingston', 1, 0), " . XXX "(6, 'Mike Judge', 0, 1)"; $results = mysql_query($people) or die(mysql_error()); echo "Data inserted successfully!"; ?> My question is just about the 2 sections on the second piece of code where I have placed 'XXX' infront of the lines I am unable to understand. How do the numbers placed in those 'XXX' lines relate to the database fields? I am unable to grasp any connection between the numbers and how they work with the database. If anyone can help me, I would be extremely grateful.
  12. That's great, the script I'm modifying is giving me a "Unknown column 'beltrank_label' in 'field list'" error and so figured just making them with PHPMyAdmin would give a clearer understanding of what I need to change in the code in order for it to work.
  13. I'm starting out on the PHP/MySQL road and currently and trying to modify a PHP script which creates the MySQL database and it's tables/fields through the code. Is this the easiest way for a noob, or to keep things as simple as possible, would I be better off using PHPMyAdmin to create the tables etc, and then just link to them with the PHP I use? Thanks everyone, Swerve1000
  14. How much do you think it would cost to employ a coder to do this for me? We need it doing in the next couple of weeks.
  15. Hi, glad to join here I am looking for some advice as to how hard would it be to modify a script, as I'm new to PHP and am unsure if it's within my capabilities. I bought a copy of of a myspace script and need to alter the search criteria. currently it is the top image (standard) and I want to change it to how it is in the second image. Many thanks! [attachment deleted by admin]
×
×
  • 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.