Jump to content

miracle_potential

Members
  • Posts

    135
  • Joined

  • Last visited

    Never

Everything posted by miracle_potential

  1. Lol I'll give it a go when I get home if your both adament its the if statement haha. They worked before. And also the first catagory works its only ever one main catagory that works which is why i believe that its not the if statement
  2. function catagories_fetch(){ //Fetch Catagories $cfmain = mysql_query( "SELECT * FROM catagories ORDER BY ID DESC") or die(mysql_error()); $cfsub = mysql_query( "SELECT * FROM subcatagories ORDER BY ID DESC") or die(mysql_error()); echo '<div id="prd">'; while($cff = mysql_fetch_array($cfmain)){ echo '<table width="680" border="0" cellspacing="0" cellpadding="0">'; echo '<tr><td class="browse">'; echo '<a href="javascript:collapse' . $cff['ID'] . '.slideit()" class="productheaders">' . str_replace("_", " ", $cff["catagory"]) . '</a>'; echo '</td></tr>'; //End Row 1 echo "<tr><td><div class='catagorydivs' id='catagorydivs" . $cff['ID'] ."' onmouseover=style.backgroundColor='#ECE0ED' onmouseout=style.backgroundColor='#FFFFFF'>"; echo "<table width='100%'>"; echo '<tr><td class="maintxt"><strong>' . $cff['dblurb'] . '</strong></td></tr><tr><td></td> </tr>'; while ($cfsubf = mysql_fetch_array($cfsub)){ if($cfsubf['CID'] == $cff['CID'] && $cfsubf['active'] = '1'){ echo '<tr><td> <a class="maintxt" href="http://new.noirorchidemporium.co.uk/Iframes/products/catagories/?paction=prod_list_pc&catagory=' . $cfsubf['catagory'] . '">' . $cfsubf['catagory'] . ' --></a></td></tr>'; }//End IF issub check }//End contained WHILE echo '<tr><td> </td></tr>'; echo '</table>'; echo '</div></td></tr>'; echo '<tr><td> </td></tr>'; //End Row 2 echo '</table>'; echo '<script type="text/javascript"> //Syntax: var uniquevar=new animatedcollapse("DIV_id", animatetime_milisec, enablepersist(true/fase), [initialstate] ) var collapse' . $cff['ID'] . ' = new animatedcollapse("catagorydivs' . $cff['ID'] .'", 400, false, [close])</script>'; }//End while echo "</div>"; }//End catagories_fetch() Theres the code really sorry about how long it is. I did try a foreach on the main catagories but it does the same thing.
  3. Lemmin is right still stuck with it ]: might just do it with XML transformations although this would be easier to update and keep on track. Although there are some slight differances but it makes no differance as to the code itself
  4. Having a little bit of trouble again *sigh* I have a loop inside a loop. Which works for the first part and only the first part. I guess my question is if a "while" statement is in another does that internal loop only run once? So really what I have is while($var = fetch_array){ some code while($second_var){ more code } } But the internal loop only runs once should I put a reset in? Thanks guys its had me stuck for days now....
  5. Servers IP could be black listed. Check yourself out on WHOis ( http://www.whois.sc/ ) and MXToolbox ( http://mxtoolbox.com/ ) You'll find out if your blacklisted otherwise its your PHP I havnt read it but it sounds like (if its delivering to other email providers) like your blacklisted.
  6. I see your point but when your programming a piece of software fair gain to anyone doing what Smarty did and stuff but strict web applications being sold as software would be good to encrypt it I mean you dont get the source for the games you buy do ya As a vendor it interests me to protect my work from code thieves too
  7. Cool so it all works? if so hit solved Have fun PHP'ing
  8. Wow over 30 days since the last post! I'm very interested in encrypting my PHP code as well as you say to prevent a client from buying and just editing it themselves. Only software I know that does this is Zend. I will look into it though and let you all know
  9. Ah I understand now try while($row = mysql_fetch_array($result)) { echo "Name: {$row['cname']} " . "Email: </strong></td><td>" . $row['cemail']; } Not sure why you have the end of table rows and stuff but hey
  10. change all your includes to this format include("maincon_contact.php"); Not sure if I understood what you were asking but that was what I saw immedietly wrong
  11. All I can suggest to save you a crap load of time is change your query to only select distinct records on the page querying from the database. Because right now I'm being way to lazy to edit that script for instance. mysql_query("SELECT DISTINCT column FROM table")or die(mysql_error());
  12. Yeah as I said I'm no wizzard with it yet but I'm learning http://new.noirorchidemporium.co.uk/testhelp.php I get that but I'm a little bewildered as to how I get this into my function and achieve the same results I'm going to have to toy with it tomorrow after work but yeah little stumped. Thank you loads though!
  13. I actually forgot the time expiration part sorry and its 10 to 1 :o I'm sure you can work out the ten minute addition by adding somethign along the lines of time()+10 in an if statement I'm too tired to work it out as of now ( its bad enough I managed to code what I did )
  14. Not sure because I need to loop it anyway because inside the loop I found before, that the "parent" loop was only bringing back one sub cat hence the second loop inside. with the current code I get one main cat appear with all the appropriate sub catagories but the second doesnt as if the loop breaks the second time round. If you could tell me how to use this query effectivly ( I'm not a PHP/MySQL magician just yet ) Thanks though
  15. I'm getting this error Configuration: includes/config.php does not exist. Please fill out the data in config.php.new and rename it to config.php So to me its just placed in the wrong directory and if I were you I'd mask out your username and password JUST in case never know whos looking at these forums
  16. There are two tables ( only as of tonight actually ) one which contains main catagories ( so Wierd_And_Wonderful and Apothercary ) And then theres a second table for sub catagories the link is in the sub catagories table in the column issub2main ( linking it with the main catagories name ) if you get me. really it needs to be done in a way I can compare the issub2main with the main catagories name and check if its active.
  17. Assuming you havnt got any code already done In a list you will need: 1. The users selected username and something to validate them by ( some log in script ) 2. Post OR GET for your form 3. Patience 4. And possibly a pair of reading glasses if you've read a PHP book and not learnt how to do it xD Ok so for number one you'll need a form so any form will do be it get or post ( just change method ) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>test</title> </head> <body> <form id="login" action="setstuff.php" method="post" enctype="multipart/form-data"> <label>Username:</label><input name="username" type="text" /> <label>Password:</label><input name="password" type="password" /> </form> </body> </html> So you have your form posting to setstuff.php <?php if(isset($_POST['change_owner'])){ mysql_query("UPDATE bonusowner SET owner='$username' WHERE date=" . $DATE)or die(mysql_error()) or die(mysql_error()); echo "woo YOUR the bonus owner now ;]"; } else{ /* set stuff.php setting variables and registering a session and containing another form to make this super quick and simple etc*/ $username = $_POST['username']; $password = $_POST['password']; //Perform an SQL query to check that users credentials $DATE = date("Y-m-d"); $query = mysql_query("SELECT username FROM table WHERE username=" . $username . " AND password=" . $password)or die(mysql_error()); $num_rows = mysql_num_rows($query); //easy way to tell if there in the database $bonus_owner_sql = mysql_query("SELECT * FROM bonusowner WHERE date=" . $DATE)or die(mysql_error()); if($num_rows > 0){ $bonus_owner = mysql_fetch_array($bonus_owner_sql); session_start(); session_name('token'); session_register($username); echo '<div style="width:300px; height:300px; border:1px solid #000000">'; echo "welcome back " . $username . "<br /><br />"; echo "current bonus owner is" . $bonus_owner . "!"; echo "whatever you plan to do...\n"; echo '<form id="change_owner" action=" ' . $PHP_SELF . '" method="post" enctype="multipart/form-data"> //Form for the button with hidden value for username <input type="hidden" value="$bonus_owner" /> <input type="button" value="GET YOUR STUFF" /> </form>'; } else{ echo "please go back to try again"; } } ?> Hopefully that works I'm half asleep so yeah have a play with that if it doesnt work at least its a start and structure for you.
  18. Hey sorry guys, having a real rough week. I've got one problem sorted but theres another minor that I think I can sort but I guess its worth asking The table structure is: CREATE TABLE catagories ( ID tinyint(4) NOT NULL auto_increment, catagory text NOT NULL, active int(1) default '0', ismain int(1) default '0', issub int(1) default '0', dblurb text NOT NULL, issub2main text NOT NULL, PRIMARY KEY (ID) ) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1; * * * INSERT INTO catagories VALUES (1,'Wierd_And_Wonderful',1,1,0,'Want something a little different as a gift or a treat?....look no further. ',''); INSERT INTO catagories VALUES (2,'Apothercary',1,1,0,'Hand-made in England, tested on humans, all natural, aromatherapy based lotions and potions',''); Thats the main catagory table CREATE TABLE subcatagories ( ID tinyint(4) NOT NULL auto_increment, catagory text NOT NULL, active int(1) NOT NULL default '0', issub2main text NOT NULL, PRIMARY KEY (ID) ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; * * * INSERT INTO subcatagories VALUES (1,'Magic_Supplies',1,'Wierd_And_Wonderful'); INSERT INTO subcatagories VALUES (2,'Chakra',1,'Wierd_And_Wonderful'); INSERT INTO subcatagories VALUES (3,'Gift_Bags',1,'Apothercary'); INSERT INTO subcatagories VALUES (4,'Massage_Oils',1,'Apothercary'); And thats the sub catagory table. And basically I'm having trouble with the loop itself it doesnt seem to loop for the second catagory I'm still toying with it. http://new.noirorchidemporium.co.uk/Iframes/products/catagories/ If you click and see guys heres a snippet of the class sorry its so long :[ function catagories_fetch(){ //Fetch Catagories $cfmain = mysql_query( "SELECT * FROM catagories WHERE ismain='1' ORDER BY ID DESC") or die(mysql_error()); $cfsub = mysql_query( "SELECT * FROM subcatagories ORDER BY ID DESC") or die(mysql_error()); echo '<div id="prd">'; while($cff = mysql_fetch_array($cfmain)){ echo '<table width="680" border="0" cellspacing="0" cellpadding="0">'; echo '<tr><td class="browse">'; echo '<a href="javascript:collapse' . $cff['ID'] . '.slideit()" class="productheaders">' . str_replace("_", " ", $cff["catagory"]) . '</a>'; echo '</td></tr>'; //End Row 1 echo "<tr><td><div class='catagorydivs' id='catagorydivs" . $cff['ID'] ."' onmouseover=style.backgroundColor='#ECE0ED' onmouseout=style.backgroundColor='#FFFFFF'>"; echo "<table width='100%'>"; echo '<tr><td class="maintxt"><strong>' . $cff['dblurb'] . '</strong></td></tr><tr><td></td> </tr>'; while ($cfsubf = mysql_fetch_array($cfsub)){ if($cfsubf['issub2main'] == $cff['catagory'] && $cfsubf['active'] = '1'){ echo '<tr><td> <a class="maintxt" href="http://new.noirorchidemporium.co.uk/Iframes/products/catagories/?paction=prod_list_pc&catagory=' . $cfsubf['catagory'] . '">' . $cfsubf['catagory'] . ' --></a></td></tr>'; }//End IF issub check }//End contained WHILE echo '<tr><td> </td></tr>'; echo '</table>'; echo '</div></td></tr>'; echo '<tr><td> </td></tr>'; //End Row 2 echo '</table>'; echo '<script type="text/javascript"> //Syntax: var uniquevar=new animatedcollapse("DIV_id", animatetime_milisec, enablepersist(true/fase), [initialstate] ) var collapse' . $cff['ID'] . ' = new animatedcollapse("catagorydivs' . $cff['ID'] .'", 400, false, [close])</script>'; }//End while echo "</div>"; }//End catagories_fetch() again apologies for my impatience before...
  19. I know and while I'm logged in I give all the help I can its just I dont know what to do with this sorry guys its just a little frustrating
  20. Please guys this is really urgent I'm behind deadline someone must be able to get what I'm trying to do
  21. <? ########################################## # read the data file into an array # each element of this array contains all of the information for each item $data_file = "csv.dat"; $line_array = file($data_file); ######################################## # make your database connection here mysql_connect("localhost", "username", "password")or die("didnt connect1"); mysql_select_db("database")or die("didnt connect2"); #################################################### # loop through the first array $number_of_items = count($line_array); $i =0; for($i=0;$i<$number_of_items;$i++) { ######################################## # explode each element into a new array using the comma as the delimiter $temp_array = explode(",",$line_array[$i]); ########################################### # make your mysql query here and # insert each field from the temp array into the proper mysql fields like $temp_array[1] in order of your rows affected $sql = mysql_query("INSERT INTO table (rows you want to effect) VALUES('$temp_array[2] ) ") or die(mysql_error()); } echo "inserted/inserting"; ?> There you go fella play with that for a while I got that from here so thanks to whoever it was that posted it originally
  22. If you can wait an hour I already have an application that converts CSV files into MYSQL So yeah wait an hour or so and I'll post it up in another reply
  23. The IF clause isnt for checking if its set to true or not. Its comparing two differant database values against each other so for example the first loop pulls all the data for a main catagory the second loop goes through the database looking for any records with a subcatagoryto with the same value as the name of the main catagory. so if(subcatagory to is the same as maincatagory and active){ loops for all values the same. } hopefully someone will understand me.... ???
  24. Try this instead of like because LIKE is an SQL command I'm pretty sure ( I should know I use it everyday ??? ) $result = mysql_query("SELECT title FROM employer_posts WHERE title='" . %$title% . "' OR description='" . %title% ."'")or die(mysql_error());
×
×
  • 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.