ok i fixed that it was upper case-lowercase issue tnx anyway
garevn 0 Newbie Poster
ok i fixed that it was a javascreipt problem tnx anyway
garevn 0 Newbie Poster
Hello erveryone.
I am new in programming and i have the following problem i cant figure out!
i want to make a search into my database.
i have prepared my html-js-php files but it seems i have a php problem.
When i search and i type whatever letter then i get those results only..
name:
brand:
price
//my php file
<?php require_once('../Connections/Mysitedb.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_Recordset1 = "-1";
if (isset($_GET['productname'])) {
$colname_Recordset1 = $_GET['productname'];
}
mysql_select_db($database_Mysitedb, $Mysitedb);
$query_Recordset1 = sprintf("SELECT manufacturer, productname, price FROM products WHERE productname = %s", GetSQLValueString($colname_Recordset1, "text"));
$Recordset1 = mysql_query($query_Recordset1, $Mysitedb) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!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>Untitled Document</title>
</head>
<body>
<?php do …
garevn 0 Newbie Poster
Hellow i have the following files
body.html
data.php
js3.js
I am trying to create an ajax search but it doesnt work....:(
The js code is:
var xmlHttp
function finding(str){
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch (e) {
try {
xmlhttp = new XMLHttpRequest()
}catch (e) {
alert("Browser does not support HTTP Request")
return
}
var url="data.php"
url=url+"?productname="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}}}
function stateChanged()
{
if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("result").innerHTML=xmlHttp.responseText
}
}
function stateChanged()
{
if(xmlHttp.readyState==4|| xmlHttp.readyState=="complete")
{
document.getElementById("result").innerHTML=xmlHttp.responseText
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
}
The html code containes:
<script src="js3.js"></script>
</head>
<body>
<form>
search:
<input type="text" size="30" onkeyup="finding(this.value)"/>
</form>
<p><div id="Result"></div>
</p>
</body>
</html>
Pls need some help!!!tnx
garevn 0 Newbie Poster
Hello, i am new in c programming it is just the second month i i deal with. I am really confusing about what i have to do with this exercise pls don't lough on me I hope for some help. That's what i have to do..
I have to modify an .ini file.
The user should enter a name which must be name1 or name2 else he get an error.
The user should enter the value of the name
the format is name1(or 2)=value
If the user use -D the input gets delete from ini
if the user dont enter both name and value gets an error
if the arguements allready exist replace them, if not add them
close file.
Thats what i have tried i have stuck soz again for this bad programme as i said its my second month
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <string.h>
int delete= 0;
char parname[20];
char valname[20];
FILE *fdin;
char file[300];
char infile[60];
void main(int argc, char* argv[])
{if (argc!=3)
return;
strcpy(parname,argv[1]);
printf("Enter Parameter Name= %s \n",parname);
printf("Enter the value= %s \n",valname);
if ((fdin=fopen(infile,"r"))==NULL)
{ printf ("Open Error");
return;
}
for (n=0 ; fgets(file,sizeof(file),fdin); ++n)
for (i=2;i<argc;++i)
{ if(strcmp(argv[i],"-D")==0)
delete=-1;
garevn 0 Newbie Poster
Its ok for me the answer provided in C language or c++
I thought no many differences exist
garevn 0 Newbie Poster
I don't know where to start.
Are you using C or C++? You can't use <iostream> in C, but "delete" is a reserved word in C++. Neither language has <conio.h> (which is an archaic and non-standard header) or void main().
Your input problems are something else altogether, but you need to decide what language you're using first.
I use c++ if u could provide some help i would appreciate thank you :)
garevn 0 Newbie Poster
Hello, i am new in c programming it is just the second month i i deal with. I am really confusing about what i have to do with this exercise pls don't lough on me :( I hope for some help. That's what i have to do..
I have to modify an .ini file.
The user should enter a name which must be name1 or name2 else he get an error.
The user should enter the value of the name
the format is name1(or 2)=value
If the user use -D the input gets delete from ini
if the user dont enter both name and value gets an error
if the arguements allready exist replace them, if not add them
close file.
Thats what i have tried i have stuck soz again for this bad programme as i said its my second month :(
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <string.h>
int delete= 0;
char parname[20];
char valname[20];
FILE *fdin;
char file[300];
char infile[60];
void main(int argc, char* argv[])
{if (argc!=3)
return;
strcpy(parname,argv[1]);
printf("Enter Parameter Name= %s \n",parname);
printf("Enter the value= %s \n",valname);
if ((fdin=fopen(infile,"r"))==NULL)
{ printf ("Open Error");
return;
}
for (n=0 ; fgets(file,sizeof(file),fdin); ++n)
for (i=2;i<argc;++i)
{ if(strcmp(argv[i],"-D")==0)
delete=-1;