Can anyone help me figure out how to fix these errors? Warning: mysql select db(): supplied argument is not a valid MySQL-Link resource in /home/xxxxx /index.php on line 37 Line 37 is: mysql_select_db($conn, "yourmil_content"); ----------------------------------------------------------------------------- Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in/home/xxxxxx/index.php on line 247 Line 247 is: $result = mysql_query($sql, $conn); --------------------------------------------------------------------------------------------------- Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in/home/xxxxx/index.php on line 248 Line 248 is: $data = mysql_fetch_array($result);

Member Avatar
Member Avatar
+0 forum 5

My code technically works, as it registers the user, but it won't keep the user logged in. (yes, once a registration is successful, they should be logged into their new account). It should go right to the index page on success and have the user logged in. On failure it should reload the page with an error message with in the <p id="error"></p> tags. It doesn't but thats another issue. so registration.php: <?php require_once('checklogin.php'); if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form")) { $con = mysql_connect('localhost','jddancks','csc255'); mysql_select_db('dancks_db',$con); $match = array(); $query = sprintf("SELECT * FROM UserTable WHERE nick='%s' OR email='%s'", mysql_real_escape_string($_POST['nick']), mysql_real_escape_string($_POST['e-mail'])); …

Member Avatar
Member Avatar
+0 forum 5

I'm not sure why I suck so bad at this. I was recommended by my prof to use date as opposed to timestamp. I'm starting to think going back to timestamp would be easier due to built in php functions I can use. so in my original addproduct.php form I have: <p>Date: Month: <select name="month" id="month"> <script type="text/javascript"> month(); </script> </select> Day: <select name="day" id="day"> <script type="text/javascript"> day(); </script> </select> Year: <select name="year" id="year"> <script type="text/javascript"> year(); </script> </select> </p> And then formatted in add.php: if(check_post('day')&&check_post('month')&&check_post('year')) { //die("day: ".$_POST['day']." month: ".$_POST['month']." year: ".$_POST['year']); if(!check_post('day',"Select Day")&&!check_post('month',"Select Month")&&!check_post('year',"Select Year")) { $days = …

Member Avatar
Member Avatar
+0 forum 7

A lot of code here. Basically I'm making an auction type site. This segment of code is for a user to upload a product: I'm pretty sure there isn't anything wrong with addproduct.php but for completeness I feel like I should post it. addproduct.php: <?php require_once('checklogin.php'); require_once('validate.php'); if(!isset($_SESSION['user'])) { //die("redirect"); header('Location:http://cs4.sunyocc.edu/~j.d.dancks/onestopshop/'); } $con = mysql_connect('localhost','jddancks','csc255'); mysql_select_db('dancks_db',$con); ?> <!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>List product at the OneStopShop</title> <style type="text/css"> #errors { visibility:hidden; color:#060606; background-color:#F00; } </style> <script type="text/javascript"> function month() { var theMonths = new Array("January", "February", "March", "April", …

Member Avatar
Member Avatar
+0 forum 8

This is based on advise given ina previous thread I posted awhile ago for protecting data. I tried the following: <?php function base_encode($text) { $size = strlen($text); $str=""; for($i=0;$i<$size;$i++) { $str=$str.slide_left(substr($text,0,1),4); $text=substr($text,-1); } return $str; } function base_decode($text) { $size = strlen($text); $str=""; for($i=0;$i<$size;$i++) { $str=$str.slide_right(substr($text,0,1),4); $text=substr($text,-1); } return $str; } function get_num($i) { $j=0; for($j;(($j<128)&&(chr($j)!=$i));$j++){} return $j; } function slide_left($i,$num) { //$str="-1"; $nn = get_num($i); //if($nn!=-1) //{ //$nn = ($nn+$num)%count($valid_chars); $str = chr(($nn+$num)%count(128)); //$str = $valid_chars[$nn]; //}*/ return $str; } function slide_right($i,$num) { $str="-1"; $nn = get_num($i); $nn-=$num; if($nn<0) { $nn+=count(128); } $str = chr($nn); return $str; } function …

Member Avatar
Member Avatar
+0 forum 1

Hey guys its me again: Basically everything on this page, at least the parts I'm able to test, are working, problem is addproduct.php is supposed to print errors when error checking the form and repopulate the data fields with the previously submitted data. I'm doing this by populating $_SESSION. addproduct.php: <?php require_once('checklogin.php'); if(!isset($_SESSION['user'])) { die("redirect"); header('Location:cs4.sunyocc.edu/~j.d.dancks/onestopshop/'); } $con = mysql_connect('localhost','jddancks','csc255'); mysql_select_db('dancks_db',$con); //var_dump($_SESSION); //die(); ?> <!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>List product at the OneStopShop</title> <style type="text/css"> #errors { visibility:hidden; color:#FF; } </style> <script type="text/javascript"> function errs() { <?php if(isset($_SESSION['prod_errs'])) …

Member Avatar
Member Avatar
+0 forum 4

Based off some stuff from my last thread I tried to write a search results page using maximum 3 parameters. I used a couple of function to try and get everything organized. One: sort_mysql_results has no defined parameters so I can put in as many parameters as needed. The code itself doesn't throw any errors but it obviously doesn't work. I tried debugging by adding echo to each function to see what is being executed. I find only one executes. Code: (kinda long, sorry) <?php function get_soundex_query($str,$member) { $ss = sprintf("SELECT *, SOUNDEX('%s') AS src, SOUNDEX(%s) AS src2",$str,$member); $ss = …

Member Avatar
Member Avatar
+0 forum 15

I am making a basic craigslist type website with a search function. There is a field where you can enter what you think the name of the product might be and my search function is supposed to find names of products that match. so for example a user can enter: "squat rack" "squatrack" "sqaut rack" "squat rac" "scuat rack" "squart rac" (you know, in case of a typo) and hopefull what will show up in the serach results is: "squat rack" "some other kind of rack" "squat machine" and things that are similar. I used "/<name of product>/" as my …

Member Avatar
Member Avatar
+0 forum 25

[CODE]<?php if(isset($_REQUEST['action'])) { $value=$_REQUEST['check']; foreach($value as $ids) { $mdelete="DELETE FROM songs WHERE id='".$ids."'"; mysql_query($mdelete); } } ?>[/CODE]

Member Avatar
Member Avatar
+0 forum 5

Is it possible to read and write excel files on PHP4? If yes, how? Thanks

Member Avatar
Member Avatar
+0 forum 4

The End.