
dubfoundry
Members-
Posts
20 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
dubfoundry's Achievements

Newbie (1/5)
0
Reputation
-
The following code suppose to output a category sub category list..it only out puts a single row under each category it doesnt do all the subcats...here is the final code i have...i cant figure out why it would only print one row...The sql statement works perfectly in phpadmin.. if(isset($_GET['upload'])&& !isset($_GET['edit_gal'])){ require_once('upload.php'); }elseif(isset($_GET['edit_gal'])){ mysql_select_db($database, $makeconnection); $query = "SELECT * FROM tbl_gallery g, tbl_subgallery s WHERE s.gal_id=g.gal_id ORDER BY s.gal_id"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($result); $prev_section = null; $sectionHeading = false; //echo '<table border="1" cellpadding="5" cellspacing="2">'; do{ if($prev_section != $row['gal_name']) { $prev_section = $row['gal_name']; $sectionHeading = false; } if(!$sectionHeading) { echo '<h1>' . $row['gal_name'] . '</h1>'; $sectionHeading = true; } else { echo $row['subgal_name'].'<p> </p'; } }while($row = mysql_fetch_assoc($result)); } }
-
[SOLVED] mysql_fetch_assoc(): supplied argument ERror
dubfoundry replied to dubfoundry's topic in PHP Coding Help
So any thaughts why this is not printing the complete sublist guys??? help -
[SOLVED] mysql_fetch_assoc(): supplied argument ERror
dubfoundry replied to dubfoundry's topic in PHP Coding Help
no there is a if statement before the code if(isset($_GET['upload'])&& !isset($_GET['edit_gal'])){ require_once('upload.php'); }elseif(isset($_GET['edit_gal'])){ -
[SOLVED] mysql_fetch_assoc(): supplied argument ERror
dubfoundry replied to dubfoundry's topic in PHP Coding Help
ok it works but just with one problem it only out puts a single row under each category it doesnt do the rest...here is the final code i have...i cant figure out why it would only print one row... mysql_select_db($database, $makeconnection); $query = "SELECT * FROM tbl_gallery g, tbl_subgallery s WHERE s.gal_id=g.gal_id ORDER BY s.gal_id"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($result); $prev_section = null; $sectionHeading = false; //echo '<table border="1" cellpadding="5" cellspacing="2">'; do{ if($prev_section != $row['gal_name']) { $prev_section = $row['gal_name']; $sectionHeading = false; } if(!$sectionHeading) { echo '<h1>' . $row['gal_name'] . '</h1>'; $sectionHeading = true; } else { echo $row['subgal_name'].'<p> </p'; } }while($row = mysql_fetch_assoc($result)); } -
[SOLVED] mysql_fetch_assoc(): supplied argument ERror
dubfoundry replied to dubfoundry's topic in PHP Coding Help
OK it said no database selected ..i forgot that line...its now working thank fellows.. hey if i have any other problem with it ill let you know.... appreciate it. -
I'm working with a simple straight forward code and keep getting this error message mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource here is the code $query = "SELECT * FROM tbl_gallery g, tbl_subgallery s WHERE s.gal_id=g.gal_id ORDER BY s.gal_id"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { echo '<pre>' . print_r($row, true) .' </pre>'; } the query works fine in php admin but i keep getting this message... thanx for your help
-
Ok im attempting a nested regions with php.. just to out put catalouge subcategory type ouput. The categories prints out fine but only the first subcategory outputs the other categories have blank subcats...help? here is my code if(isset($_GET['upload'])&& !isset($_GET['edit_gal'])){ require_once('upload.php'); }elseif(isset($_GET['edit_gal'])){ //require_once('gal_edit.php'); echo "<h2>Edit Albums</h2> <br/>"; ?> <p> </p><?php do{ echo $gallery['gal_name'];?> <span class="under_rule"></span> <p> </p> <?php do{ echo $subgal['gal_name'];?> <?php }while($subgal = mysql_fetch_assoc($get_subgal));?> <p> </p><p> </p> <span class="under_rule"></span> <?php }while($gallery = mysql_fetch_assoc($get_gal));}?>
-
Thank you i didn't even realize that....
-
I have this seeamingly simple code that does not execute at all for some reason...i cant figure it out. im using godaddy for hosting and im trying to send a mail via a form...Godady says it doesnt block these type of scripts and it should work...go figure.. Is there a problem with my script preventing it from working? <?php echo "<form id=\"form1\" name=\"form1\" method=\"post\" action=\"\"> <p>Full Name:<br/> <label> <input type=\"text\" name=\"name\" id=\"name\" /> <br /> </label> Email:<br/> <label> <input type=\"text\" name=\"email\" id=\"email\" /> <br /> </label> Phone:<br/> <label> <input type=\"text\" name=\"phone\" id=\"phone\" /> </label> <p>Message:<br/> <label> <textarea name=\"message\" cols=\"23\" rows=\"10\" id=\"message\"></textarea> </label> </p> <p> <label> <input type=\"Submit\" name=\"Submit\" id=\"Submit\" value=\"Submit\" /> </label> </p> </form>"; if(isset($_GET['Submit'])){ $subject = "Consultation Request"; $myEmail ="[email protected]"; $message = $_GET['message']; $phone = $_GET['phone']; $Name = $_GET['name']; $email = $_GET['email']; $mail_body = "From: ". $Name . " <" . $email . ">\r\n". $message." "; echo "Thank you"; mail($myEmail, $subject, $mail_body); }else{ echo "Please Fill the form out"; } ?>
-
I am trying to create an accordion that holds unique categories as the tab name and then a list subcategories that relate to that category in the content. What i think is happening is it is only showing one category like i need it to but then it echoes one category and repeats it in separate category content. ??? i need all subcats listed under its cat. check it here http://vaughntucker.com/exflowers/about.php? The code is <?php do { if($row_get_subcats['subcat_id']==$current_subcat){ $link_look='class="selectedPage"'; }else{ $link_look=''; } ?> <div class="AccordionPanel"> <div class="AccordionPanelTab"><a href="about.php?cat=<?php echo $row_get_cats['cat_id']; ?>" > <?php echo $row_get_cats['cat_name']; ?></a></div> <div class="AccordionPanelContent"><a href="about.php?subcat=<?php echo $row_get_subcats['subcat_id']; ?>&cat=<?php echo $row_get_cats['cat_id']; ?>" <?php echo $link_look;?>> <?php //if($row_get_cats['cat_id'] == $row_get_subcats['catsub_id']){} echo $row_get_subcats['subcat_name'];?></a></div></div> <?php }while ($row_get_cats = mysql_fetch_assoc($get_cats)); ?> Thank you for any help. view all the code here http://vaughntucker.com/exflowers/about.txt
-
dynamic nav with categories and subcategories
dubfoundry replied to dubfoundry's topic in Applications
Lol where are the experts on php freaks...your telling me they are no GURUs on here? Ok thats fine i'll figure it out.... Thanks for viewing anywayz.... ??? -
Hey guys im in the middle of customizing a php cms app to fit my site...im basically reusing some of its code. im currently working on the nav which is an accordion spry i will be using php to get categories and subcategories and echoing them so as to create the accordion. the subcategories should appear under its category. In the database there are one category for many subcats and one subcat for mutiple products...so tbl_subcat has its own id plus the cat_id as the foreign key. the origianl nav script echoed <li></li> for only categories..i adopted it for divs here is the page http://vaughntucker.com/exflowers/about.php? The problem im having is loading all the subcats under each category it only does one row and it repeats the same subcat for the rest of the categories so i know my php logic is off but im stumped... here is the entire code http://vaughntucker.com/exflowers/about.txt This is what the accordion with the do while function looks like <?php do { if($row_get_subcats['subcat_id']==$current_subcat){ $link_look='class="selectedPage"'; }else{ $link_look=''; } ?> <div class="AccordionPanel"> <div class="AccordionPanelTab"><a href="about.php?cat=<?php echo $row_get_cats['cat_id']; ?>" > <?php echo $row_get_cats['cat_name']; ?></a></div> <div class="AccordionPanelContent"><a href="about.php?subcat=<?php echo $row_get_subcats['subcat_id']; ?>&cat=<?php echo $row_get_cats['cat_id']; ?>" <?php echo $link_look;?>> <?php echo $row_get_subcats['subcat_name'];?></a></div></div> <?php }while ($row_get_cats = mysql_fetch_assoc($get_cats)); ?> i was told i need to use a where clause in my sql statement but i have problems implementing that too... here are my sql statements... //get all cats for side nav// // mysql_select_db($database, $makeconnection); $sql_get_cats = "SELECT * FROM tbl_cat ORDER BY cat_id ASC"; $get_cats = mysql_query($sql_get_cats, $makeconnection) or die(mysql_error()); $row_get_cats = mysql_fetch_assoc($get_cats); $totalRows_get_cats = mysql_num_rows($get_cats); //get all subcats for side nav//ORDER BY catsub_id ASC ASC*/ mysql_select_db($database, $makeconnection); $sql_get_subcats = "SELECT * FROM tbl_subcat "; $get_subcats = mysql_query($sql_get_subcats, $makeconnection) or die(mysql_error()); $row_get_subcats = mysql_fetch_assoc($get_subcats); $totalRows_get_subcats = mysql_num_rows($get_subcats); ///Sub category heading $current_subcat="Home"; if(isset($current_subcatNum)){ $sql_get_page="SELECT subcat_name FROM tbl_subcat WHERE subcat_id='$current_subcatNum'"; $get_subcat_name = mysql_query($sql_get_page, $makeconnection) or die(mysql_error()); $row_get_subcat_name = mysql_fetch_assoc($get_subcat_name); $current_subcat=$row_get_subcat_name['subcat_name']; } ///find page title $page_title="Home"; if(isset($current_cat)){ $sql_get_page="SELECT cat_name FROM tbl_cat WHERE cat_id='$current_cat'"; $get_title = mysql_query($sql_get_page, $makeconnection) or die(mysql_error()); $row_get_title = mysql_fetch_assoc($get_title); $page_title=$row_get_title['cat_name']; } i'll appreciate any help thanks....
-
looks like the correct value is being assigned this gets printed out Array ( [name] => pineapple plus [submit] => Search ) i typed pineapple as my search criteria
-
yea your right its the sql syntax it doesnt work at all when queried directly i got the result was empty...i took the $name variable out and used a letter like p... This worked once or twice but stop working it went back to just giving a empty respoinse.... can you tell if my syntax is inccorect check it SELECT actor_id, first_name, last_name FROM actor WHERE first_name LIKE '%" . p . "%' OR last_name LIKE '%" . p ."%';
-
no its posting to itself with that get variable....but that should'nt make a difference really i tried it with out passing any get variable to the url and got the same results so ... anymore ideas?