-
MySQL Advise
Anyone got any ideas? I'm quite puzzled by this lol...
-
MySQL Advise
Yeah tried both ways, its wierd 'cos if I try to access the page using "content.php?subj=5" the page displays correctly. However if I try using a page= variable or no variables at all that error appears - its baffled me (but thats not hard!!)
-
MySQL Advise
Nah still no joy. This one is really frying my brain lol! I think I'm in a little deep over my head now
-
MySQL Advise
Didnt work. I have added the below to my functions php; function get_subject_by_id($subject_id) { global $connection; $query = "SELECT * "; $query .= "FROM subjects "; $query .= "WHERE id=" . $subject_id; $query .= " LIMIT 1"; $result_set = mysql_query($query, $connection); confirm_query($result_set); // if no rows are returned fetch_arrey will return false if ($subject = mysql_fetch_array($result_set)) { return $subject; } else { return NULL; } } And this to my actual page; <?php $sel_subject = get_subject_by_id($sel_subj); ?> <h1><?php echo $sel_subject['menu_name']; ?></h1> However when I come to open that page I get this error; Am I missing something really daft here, or is there an issue with the LIMIT function with version 5?
-
MySQL Advise
Hi there, I'm starting to make my own CMS, and run into a couple of problems. To start with I have made a navigation bar using data from a MySQL database, as below; <?php $subject_set = get_all_subjects(); while ($subject = mysql_fetch_array($subject_set)) { echo "<li><a href-\"content1.php?subj=" . urlencode($subject["id"]) . "\">{$subject["menu_name"]}</a></li>"; $page_set = get_pages_for_subject($subject["id"]); echo "<ul>"; while ($page = mysql_fetch_array($page_set)) { echo "<li><a href=\"content1.php?page=" . urlencode($page["id"]) . "\" >{$page["menu_name"]}</a></li>"; } echo "</ul>"; } ?> I then draw back relevent data from the DB to populate the content on the page like so; <?php if (isset($_GET['subj'])) { $sel_subj = $_GET['subj']; $sel_page = ""; } elseif (isset($_GET['page'])) { $sel_page = $_GET['page']; $sel_subj = ""; } else { $sel_subj = ""; $sel_page = ""; } ?> <head></head> <body> <div id="right"> <h1><?php echo ($subject["menu_name"]); ?></h1> <p><?php echo $sel_page; ?></p> </div> </body> The $sel_page works fine, but what I am wanting to do is make the h1 tag populate with the menu name from subjects table. What I currently have in the h1 tags does not seem to work, can anyone advise why? Cheers Jamie
-
MySQL Problems
Found it! I was missing a quotation mark off after $row[2] Cheers! Jamie
-
MySQL Problems
Hello, I am currently learning PHP and MySQL, I have started with a very basic script just pulling strings back from the DB. Here is the code I am using; <?php //1. Create the connection $connection = mysql_connect("localhost","user",""); if (!$connection) { die("Database connection failed: " . mysql_error()); } //2. Select a database to use $db_select = mysql_select_db("test_cms",$connection); if (!$db_select) { die("Database selection failed: " . mysql_error()); } ?> <html> <head> <title>Basic</title> </head> <body> <?php //3. Perform database query $result = mysql_query("SELECT * FROM subjects", $connection); if (!$result) { die("Database query failed: " . mysql_error()); } //4. Use returned data while ($row = mysql_fetch_array($result)) { echo $row[1]." ".$row[2]."<br />; } ?> </body> </html> <?php //5. Close connection mysql_close($connection); ?> And the error I am getting is; Parse error: syntax error, unexpected $end in C:\wamp\www\databases.php on line 39 I'm probably missing something really easy, but for the life of me cant work it out. Has anyone got any ideas? Cheers Jamie
-
Good Tutorials?
Hey guys, I'm wanting to learn PHP and MySQL. Can anyone advise if some decent vide tutorials?
-
New Site launched
Maybe not major, but I would get rid of the "mailto:" link; I made that mistake and got inundated with spam
-
Lynda.com
Thanks for the feedback guts, I will try that 7 day freebie
-
Lynda.com
I am thinking of getting the Lynda.com CSS and PHP video tutorials. Does anyone rate these? I have seen the Photoshop CS3 tut, and it was pretty good for beginners, but not enough detail for creating your own images I didn't think...
-
My first attempt at a W3C Strict site!
Yeah I am intending to do that, just wanted the layout sorted first As I currently have fixed positions for all my divs. What's the best way of doing this? Sounds a really daft question, but I'm stuck lol
-
My first attempt at a W3C Strict site!
Ok, so I'm currently this for my nav buttons; Is that the best way of doing this? See updated version here
-
My first attempt at a W3C Strict site!
Thanks for the reply Quimp - appreciate all the advise I can get! So far I have; 1) Removed W3C images 2) Replaced the footer image which a higher res version 3) Removed the "Audi - VW - Seat - Skoda" banner from the top 4) Changed the CSS so H# only looks at headers. http://aptuning.hgkcomputers.co.uk/index2.html I agree the site at the moment does look slightly "dull" and "boring" I am waiting for my client to send some images over so I can add them to the site. (Probably liven up the black background with a faded image etc) What would the easiest way of achieving a hover effect for my links without using images? At the moment I am using; Thanks again! Jamie
-
My first attempt at a W3C Strict site!
Hi guys, well I am currently playing with a few concepts for an Audi tuning firm I have been asked to redesign their site for. First few attempts were pretty dire to be honest, simply "bodging" the code as I went! So I decided to scrap Dreamweaver and start from scratch using just notepad (and Photoshop ofcourse ) And came up with this; AP Tuning (v1.4) I'm quite impressed it was validated as Strict on my first attempted, but I feel the CSS file might be a little messy. If anyone has any spare time would they mind sending a few pointers my way? AP Tuning CSS file Anyway, as always all comments welcome Cheers Jamie