Jump to content

denoteone

Members
  • Posts

    383
  • Joined

  • Last visited

    Never

Everything posted by denoteone

  1. I am getting a "Error, insert query failed" anyone see what I am doing wrong? <?PHP mysql_connect("#", "#", "#") or die(mysql_error()); mysql_select_db("#") or die(mysql_error()); $zone = "4"; for ( $counter = 1; $counter < 239; $counter += 1) { echo $counter; $query= "INSERT INTO zones_to_geo_zones (association_id,zone_country_id,zone_id,geo_zone_id,last_modified,date_added) VALUES ('$counter','$counter', '0' ,'$zone','0', '0')"; mysql_query($query) or die('Error, insert query failed'); } ?>
  2. got it working thanks for your help!
  3. I would like to split a variable at the "." and then save the part to the right in a new variable called $ext. I am pretty sure that I would use split but I am having and issue. $file = "mypage.php"; $ext = split($file."."); echo $ext[1]; should read php Thanks
  4. Is it possible to add a week to the current date using strtotime? something like $today = date("m.d.y"); echo date($today,strtotime(+1 week));
  5. I thought that I knew how to use TRIM() but I am having issues. can someone help me with the SQL Statement to remove the "%" at the end of all entries in the accountPCT field?
  6. done thanks for the advice on the same script is the best way to check to see if a variable is an integer by using regex?
  7. The data was given to me as an .csv file. So i have no control over the values of the field. But I am testing now. Thanks for the help.
  8. I have a column named successPct and the entries look like 95%, 85%, 99% and so on. Is it possible to write a select statement like what follows since there is a "%" in the number? $query = "SELECT * FROM my_table WHERE successPct >= '55%'"; would this make sense?
  9. This is how i got it done incase anyone has this issue in the future. $table = $_GET['table']; $param1 = $_GET['param1']; $var1 = $_GET['var1']; $param2 = $_GET['param2']; $var2 = $_GET['var2']; $border = $_GET['border']; $color = $_GET['color']; require_once('visitors_connections.php'); mysql_select_db($database_visitors, $visitors); $query = "SELECT * FROM $table WHERE $param1 = '$var1' and $param2 = '$var2'"; $result = mysql_query($query)or die (mysql_error()); echo "<table width=100% style='font:12px arial; color:{$color}'>"; while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ echo "<tr>"; $i = "0"; foreach($row as $value){ echo "<td>{$value}</td>"; $i = $i + "1"; } echo "</tr>"; } echo "</table>";
  10. So would something like this work? I am kinda confused about the $row = mysql_fetch_array($result, MYSQL_ASSOC)) and how it creates the array... $query = "SELECT * FROM '$table' WHERE '$parm1' = '$var1' and '$parm2' = '$var2'"; $result = mysql_query($query)or die (mysql_error()); echo "<table width=100%>" while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ echo "<tr>"; i = 0; foreach($row as $value){ echo "<td>$row[i]</td>"; i = i +1; } echo "</tr>"; } echo "</table>";
  11. Is there anyway that I can shorten the fallowing code? lets say i didn't know the column names? if($table == "TBPlayer"){ if($parm1 == '' or $parm2 == ''){ }else{ $query = "SELECT * FROM '$table' WHERE '$parm1' = '$var1' and '$parm2' = '$var2'"; $result = mysql_query($query)or die (mysql_error()); echo "<table width=100%>" while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ echo "<tr> <td>{$row['entryID']}</td> <td>{$row['playerID']}</td> <td>{$row['locationID']}</td> <td>{$row['playerName']}</td> <td>{$row['playerOrientation']}</td> <td>{$row['playerResolution']}</td> <td>{$row['playerModel']}</td> <td>{$row['ipAddress']}</td> <td>{$row['signCount']}/td> <td>{$row['postDate']}</td></tr>"; } echo "</table>"; } {
  12. Thanks Ken2k7 but I am still a little unclear. i checked out php.net/mysql_fetch_row() and have a question. Would it be possible to do something like... $query = "SELECT * FROM '$table' WHERE '$param1' = '$var1'"; $result = mysql_query($query)or die (mysql_error()); foreach ($result as $line) { echo "<tr>"; foreach( $line as $values) //loop through table columns and print them in cells but I dont know how many times to loop in this one. { echo "<td> '{$result[i]}' </td>"; } echo "</tr>"; } echo "</table>";
  13. I am try to make a dynamic script that will print data from a table into a nice neat HTML table. The only problem is I am only given the table name and one search able parameter and the value of that parameter. So I do not know how many columns there are since It varies. below will maybe help you visualize what I am trying to do. url= http://www.mysite.com?table=visitors&param1=name&var1=mike $table = $_GET['table']; $param1 = $_GET['param1']; $var1 = $_GET['var1']; //database connect code $query = "SELECT * FROM '$table' WHERE '$param1' = '$var1'"; $result = mysql_query($query)or die (mysql_error()); now I want to print the data that is returned so I have to first find out how many total columns there are and there names. would I use two foreach loops with in earch other? one for each line returned in the query? and then the value of the columns within that line? can anyone help me with this?
  14. I was given a csv file with a column for dates. they are in this format: 8/27/2008 12:49 i want to pass a variable in my url so that I can search by database so that I return everything from that date on. so the url would be www.mysite.com?date=08/01/2008 can i use that variable to search the date field in my database? something like $date = $_GET['date']; $query = "SELECT *FROM tablename WHERE postDate >= '$date'"; $result = mysql_query($query)or die (mysql_error());
  15. I am checking a database to see if a variable is in there if it is I want to do something. Am I on the right track here? the varible $row['visitor_whois'] changes because this is part of a bigger while statement. $query = "SELECT * FROM isp WHERE name = $row['visitor_whois']"; $result = mysql_query($query)or die (mysql_error()); if( $result == "true"){ }
  16. There was an issue somewhere in the rest of my content in the HTML. Thanks everyone. I will use the Validation before posting for now on.
  17. <?PHP ini_set("display_errors","2"); ERROR_REPORTING(E_ALL); //this conditional will send the email after the submit if(isset($_POST["B1"])) { $name = $_POST['contact_name']; $company = $_POST['contact_company']; $email = $_POST['contact_email']; $phone = $_POST['contact_phone']; $comments = $_POST['contact_comments']; $my_message = ' Please contact '.$name.' here is there info:'.$email.' '.$company.' '.$phone.' here are the comments '.$comments.' '; $subject = 'SuperLumin Contact Request'; $headers = "From: ".$email."\r\n"; $headers .= "Reply-To: you3@email.com\r\n"; $headers .= "CC: you2@email.com\r\n"; $headers .= "Content-type: text/html\r\n"; mail('you@email.com',$subject,$my_message,$headers); ?> <html> <head> </head> <body> <b>Thank You!</b> <META HTTP-EQUIV = 'Refresh' Content = '2; URL = index.html'> </body> </html> <?PHP }else{ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> Contact Request</title> </head> <body> <form action="<?=$_SERVER['PHP_SELF']?>" method="POST"> <table style="font:bold 12px Verdana, Arial, Helvetica, sans-serif; margin:0px auto; margin-top:20px;" width="80%" border="0" align="center" cellspacing="10"> <tr> <td align="right" width="40%">*Full Name:</td> <td width="60%"><input type="text" name="contact_name" size="40" /></td> </tr> <tr> <td align="right" width="40%">*Company:</td> <td width="60%"><input type="text" name="contact_company" size="40" /></td> </tr> <tr> <td align="right" width="40%">*Email:</td> <td width="60%"><input type="text" name="contact_email" size="40" /></td> </tr> <tr> <td align="right" width="40%">Phone:</td> <td width="60%"><input type="text" name="contact_phone" size="40" /></td> </tr> <tr> <td align="right">Comments:</td> <td><textarea rows="5" cols="35" name="contact_comments"></textarea></td> </tr> <tr> <td align="right"><a href="test.html">tester</a></td> <td><input type="submit" value="Submit" border="0" name="B1"> <input type="reset" value="Reset" name="reset"> </td> </tr> </table> </form> </body> </html> <?php } ?>
  18. in I.E. it works and submits data. But in F.F. when I rollover the button it doesn't even give me the option to click.
  19. I have a form that submits data to a script. But when I put in a <textarea></textarea> in the form the submit button does not work in Fire Fox? I have made many pages with forms before. Has any one ran into this issue before? Could it be a doctype issue? <form action="<?=$_SERVER['PHP_SELF']?>" method=POST> Comments: <textarea rows="5" cols="35" name="contact_comments"></textarea> </form>
  20. I am having a simple issue here that has me stuck. I am trying to check to see if the box is selected and if so echo whats inside of the if statement. Show Pages: <input type="checkbox" name="pages" value="true"> Show Reffer: <input type="checkbox" name="ref" value="yes"> if both of these are checked and on submit would this work? $showpages = $_POST['pages']; $showref = $_POST['ref']; echo $showpages; echo $showref; output would be trueyes but my script is getting Notice: Undefined index: pages error can anyone help me
  21. if(isset($_COOKIE['ID_my_site'])) { show site }else{ redirect } is there any way to remove the cookie when the window or browser closes. so they have to log back in.
  22. when I add $query = "SELECT visitor_ip FROM visitor_list WHERE visitor_day = '$today' and visitor_month = '$month'"; $result = mysql_query($query)or die (mysql_error()); print_r(mysql_fetch_assoc($result)); it is only getting one IP address there should be like 2o rows that all have the same day and month all with different visitor_ip entries. I need to run a for loop for everyone of those different ip's
  23. Warning: Wrong parameter count for mysql_fetch_assoc() in /var/www/html/ipupdate.php on line 18
×
×
  • 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.