|
My first suggestion would be that you DO NOT YELL! For many people there will be a perceived inference that they are not intelligent enough to identify important parts of the question..
My second suggestion would be to do as one always does when programming, and break the problem up into a number of smaller steps/chunks. In essence, the concept is really quite simple:
1) Implement access control system - i.e password=correct, pass=true. password=incorrect, pass=false
2) Devise a way of storing page data in a database
3) Implement a way of adding user-entered text into the database tables used in step 2
None of these 3 steps necessarily need to be complicated in order to provide basic functionality.
I'd expect to be able to bash out some code that would allow me to dynamically add page content if my password was correct in a few hours.
The polishing, refining and adding of other expected features are what I expect to take the absolute bulk of the time.
It's only 1/2 a Mb, why not download the code and take a look at it? You do get all the source code after all.
I've gleaned dozens of tips from the old game engines wolf3d, doom, quake, etc. Yet I've not copy/pasted a single line of code from any of them. Humans 'progress' because we are able to build-upon and extend the work of others..
|
|
|
|
|
Is it possible to have voice recording feature in a php based website.
|
|
|
|
|
|
Is there any free solution for voice recording in php?
|
|
|
|
|
You will need to find out for yourself. Try running that google query with free tossed in. Otherwise just start looking through the results you get from google. This will als o giv you a basic idea as to how they did it, like what tools or language features did they use.
best of luck!
Chris J
www.redash.org
|
|
|
|
|
hello there
i have a form for submiting data into mysql table with the name of TERM_LESSON table in this form i have a sets of checkboxes that came from a table with the name GRADE these are my two tables:
TERM_LESSON
CREATE TABLE IF NOT EXISTS `term_lesson` (
`lid` int(5) NOT NULL,
`gradeid` int(1) NOT NULL,
PRIMARY KEY (`lid`,`gradeid`)
) ENGINE=MyISAM ;
GRADE
CREATE TABLE IF NOT EXISTS `grade` (
`gradeid` int(11) NOT NULL AUTO_INCREMENT,
`gname` varchar(40) NOT NULL,
PRIMARY KEY (`gradeid`)
) ENGINE=MyISAM AUTO_INCREMENT=0 ;
and this is my form:
<!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>
<form action="<?php echo $editFormAction; ?>" method="post" id="form1">
<table align="center">
<tr valign="baseline">
<td align="right">LID</td>
<td">
<input name="lid[]" type="text" id="lid[]" value="<?php echo $row_rslesson['lid']; ?>" size="32" readonly="readonly" />
</td>
</tr>
<td >GRADE</td>
<td >
<?php do { ?>
<input name="gradeid[]" type="checkbox" id="gradeid[]" value="<?php echo $row_rstotalgrade['gradeid']; ?>" />
<label for="gradeid[]"></label>
<?php echo $row_rstotalgrade['gname']; ?><br />
<?php } while ($row_rstotalgrade = mysql_fetch_assoc($rstotalgrade)); ?></td>
<tr valign="baseline">
<td style="text-align: center"></td>
<td align="right"><input type="submit" value="submit" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
</body>
</html>
i want to make a TABLE ROW in TERM_LESSON for every checkboxes that is selected by user with same LID in form like: (for 2 chekbox seledted)
lid gradeid
11 , 1
11 , 2
and this is my php code for doing that:
<?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;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
foreach ($_POST['gradeid'] as $i) {
$insertSQL = sprintf("INSERT INTO term_lesson (lid, gradeid) VALUES (%s, %s)",
GetSQLValueString($_POST['lid'], "int"),
GetSQLValueString($i, "int"));
mysql_select_db($database_register, $register);
$Result1 = mysql_query($insertSQL, $register) or die(mysql_error());
}
$insertGoTo = "lesson_term_added.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_register, $register);
$query_rstotalgrade = "SELECT * FROM grade";
$rstotalgrade = mysql_query($query_rstotalgrade, $register) or die(mysql_error());
$row_rstotalgrade = mysql_fetch_assoc($rstotalgrade);
$totalRows_rstotalgrade = mysql_num_rows($rstotalgrade);
?>
but when i submit the form i face to this error :
Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in C:\wamp\www\register\admin\add_lesson_term.php on line 11
Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in C:\wamp\www\register\admin\add_lesson_term.php on line 11
Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in C:\wamp\www\register\admin\add_lesson_term.php on line 11
Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in C:\wamp\www\register\admin\add_lesson_term.php on line 11
Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in C:\wamp\www\register\admin\add_lesson_term.php on line 11
Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in C:\wamp\www\register\admin\add_lesson_term.php on line 11
Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in C:\wamp\www\register\admin\add_lesson_term.php on line 11
Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in C:\wamp\www\register\admin\add_lesson_term.php on line 11
Column 'lid' cannot be null
i appreciate any idea.
with prior thanks
|
|
|
|
|
I wanna some one please advise me where can i begin to learn PHP and have a good experience
|
|
|
|
|
That is interesting.......
if you have experience with other programming language, i think you can start learning php.
If you dont know any other programming language, i am sure you are going to be slow.
You can collect a book. I started learning PHP reading a book published by Wrox publications. written bye 4 writer. i dont remember the name.
And about being professional?: start career as trainee somewhere. If you have the quality to be a programmer you will be.
Otherwise without real work there is no way being professional
|
|
|
|
|
thanks so much Johny
i am already knowing a programming language
and i learned about php but i stopped in session and cookies and can't complete till understand these subjects so thanks so much for ur care .
|
|
|
|
|
|
thanks so much Richard A. Abbottfor ur effort these sites is very helpful
|
|
|
|
|
look at the source code for some open source php projects. As a programmer you are going to read a lot of code, but if you can understand why the programmer designed the app the way he did you will gain quite a bit of info.
Chris J
www.redash.org
|
|
|
|
|
i don't know why my firefox browser executing mysql query two times. and this is happening only with firefox. i have tested the code with chrome and opera and its working fine.
modified on Thursday, August 11, 2011 9:45 AM
|
|
|
|
|
The fact is your browser doesn't execute your query twice. your php/html code has an mistake. different browser handle your mistake html code differently. may be that is why you are seeing result twice.
read your returned code.
Better is post your php code
|
|
|
|
|
i am posting my mysql query check it if you find any problem?
$sql_item=mysql_query("select * from add_out_stock where challan_no='$challan_no'");
while($rs=mysql_fetch_array($sql_item))
{
$cata_name=$rs['catalogue_name'];
$design_no=$rs['design_no'];
$qty=$rs['quantity'];
$sql_stock=mysql_fetch_array(mysql_query("select * from stock where catalogue_name='$cata_name' AND design_no ='$design_no'"));
$tqty=$sql_stock['roll_no']-$qty;
$qty= mysql_query("update stock set roll_no='$tqty' where catalogue_name='$cata_name' AND design_no ='$design_no'");
}
when i am using this code it executing $qty two times
|
|
|
|
|
What type of request are you sending to server from your broswer?
is it ajax request ? normal request?
|
|
|
|
|
its a normal request. i am just opening the page in localhost or server.
|
|
|
|
|
It's VERY frustrating for me , i am facing this problem for past 2 month. but i am not able to find any soln. for it.
|
|
|
|
|
Have you done this[^] yet? It will take a lot less than 2 months.
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
what is this? i don't understand. i have tested the code using basic insertion and using some complicated code. but i am not able to find any soln for it.using live http header . but did not find any soln.
|
|
|
|
|
If your SQL code is getting run twice for a particular browser but not others, you need to find out how many HTTP requests and responses are sent. LiveHTTPHeaders is a Firefox plugin, so can't see what happens on other browsers. Wireshark is independent of the browser, so it provides an impartial record of the HTTP traffic. If there is one request/response when it fails, then the problem is on the server side. If there are two, then you need to find out what is causing the second one. Javascript/JQuery in the browser, maybe?
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
ok let me try this one. than i will reply.
thanks for suggestion.
|
|
|
|
|
if you are running the server in Linux then execute the code
and see how its behave:
>php test.php
if you found two entry then something is not right about your php
you also try the same statement in mysql from command prompt
By the way, tell me this. did you installed phpmyadmin?
try to insert from phpmyadmin, if it insert more than one input php, try reinstall it. i am not sure is there any thing to do with your apache installaion and configuration
|
|
|
|
|
problem is that when i echo my mysql query it show only one time but it execute the code two times. and i have also tested the sql directly into the phpmyadmin but there its working fine.
|
|
|
|
|
i have found the soln.for the problem. when i have tested the code on other pc with firefox than it running perfectly fine so i have tested the header request and found out that it sending two url request. so i Google it and found out that its happening because of yslow add-on. when i disable it query running fine. thanks to you guys for your valuable suggestion.
|
|
|
|