Jump to content
xisto Community
joe.k

PHP And SQL Databases: Please Help! need help

Recommended Posts

iam new to PHP and SQL and i have recently been learning them on my IIS using easyphp and till now i only got the basics ...not all of them coz most of the sites i have been theough was either:
1.not making any sence at all (i always get erorrs) especial in the last line
i always seem to get something wrong in the php code which i cant find any explaination in any tut i have read till now.

most bugging serror was in this line </html>
:):)

so please if you know any site that explain in a simple way and provide some example (usefull example and mostly used). :):)
the most of tut. i see which take about php and SQl (what are they) which i know but then they start jumping from varibles to $GET without making some clear idea how to make the best advantage use out of them and some of them have a link to other tut. on other sites which the links to them is broken or the pages was deleted.
:)

Share this post


Link to post
Share on other sites

Well, I think the best way you would learn if you would search google for tutorials or something like that, because the best way to learn it is by yourself and all you need is practice :) here is a basic site which can lead you to that side and with time when your knowledge gets better, all you need is to continue and if you will have a problem you always can ask and get serious support on some forums or even better on irc #mysql support channels, for example on freenode server. :)

http://www.w3schools.com/sql/default.asp

Share this post


Link to post
Share on other sites

Looks like your mixing and matching HTML and PHP. First of all you need to start your PHP code like this..<?phpand end it like?>That. My guess is that your trying to end your php code with a html tag like this. </html>

Share this post


Link to post
Share on other sites

Looks like your mixing and matching HTML and PHP.


First of all you need to start your PHP code like this..

<?php

and end it like

?>

That.



My guess is that your trying to end your php code with a html tag like this.

</html>


i guess you didnt catch up what iam exactly talking about here... i use Golive for my project and it's seem i had a little mixed up with something in the command or forgot to put " or ; .. :)
anyway i tried to make a Insert command for the SQL where you put a user and a password
i tried to hash the password using MD5 puy got and erorr and dono where to put it.
i made 2 files:
1.mailing list.php
2.insertmail.php

***************
mailing list.php has this code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>	<!-- InstanceBegin template="template3.action" -->		<head>			<meta name="keywords" content="Wasieh school, grade11, Jo,Wasieh,Grade11, Class11,JO, Jordan , Wasieh-Grade11">			<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">			<meta name="author" content="Joesph Kaleel ,Jo 00962-03">			<meta name="copyright" content="Š2005-2007">			<meta name="language" content="English /US">			<meta name="organization" content="Wasieh.grade11 ">			<meta name="generator" content="Golive,Photoshop By Joesph.k">			<title>Grade11</title>			<csscriptdict import>				<script type="text/javascript" src="GeneratedItems/CSScriptLib.js"></script>			</csscriptdict>			<!-- #BeginHeadLocked "" -->				<meta name="organization" content="Wasieh.grade11 ">				<meta name="language" content="English /US">				<meta name="copyright" content="Š2005-2007">				<meta name="author" content="Joesph Kaleel ,Jo 00962-03">				<meta name="keywords" content="Wasieh school, grade11, Jo,Wasieh,Grade11, Class11,JO, Jordan , Wasieh-Grade11">				<link rel="shortcut icon" type="image/x-icon" href="icons/favicon.ico">				<style type="text/css" media="screen"><!--#navico  { margin: 2px 25px }#navico2 { margin: 2px 25px }#navico3 { margin: 2px 25px }#navico4 { margin: 2px 25px }#navico5 { margin: 2px 25px }#navico6 { margin: 2px 25px }#navico7 { margin: 2px 25px }#navico8 { margin: 2px 25px }#Clock   { color: #033; font-size: 11.5px; margin: 5px 12px 5px 20px }#Name		   { color: #333; font-size: 75px; font-family: "Courier New"; font-weight: 600; margin: 75px 10px 75px 110px }#Name2 { color: #000; font-family: Georgia, Arial }#Spon	 { color: #c00; font-size: 10.2px; font-family: Dotum; margin-bottom: 50px; margin-left: 110px }#_top { color: #000; font-size: 11px; font-family: Tahoma, "Trebuchet MS"; margin-right: 20px; margin-left: 20px }#ttt	  { color: #000; font-size: 11px; font-family: "Trebuchet MS", "Trebuchet MS"; margin: 20px 30px 0 }.p  { color: #000; font-size: 12px; margin: 0 0 0 25px }.pline1  { color: #000; font-size: 14px; font-family: Verdana, "Comic Sans MS"; margin: 0 0 0 10px }.pline2  { color: #333; font-size: 13px; margin: 0 0 0 18px }#Note1 { color: #000; margin: 25px 20px 0; padding: 0 }#Note2 { color: #000; margin: 25px 20px 0; padding: 0 }#Note3 { color: #000; margin: 25px 20px 0; padding: 0; }.soon  { color: #c00; font-size: 18px; font-family: Arial, Georgia, Geneva, "Courier New"; font-weight: 500; margin-top: 5px; margin-left: 10px }--></style>				<csactions>					<csaction name="4559d80" class="Goto Link" type="onevent" val0="index.php" val1="Index" urlparams="1"></csaction>					<csaction name="4a8cf61" class="Goto Link" type="onevent" val0="http://ogmmj.Forumer.com" val1="Forumer" urlparams="1"></csaction>					<csaction name="4baf2e2" class="Goto Link" type="onevent" val0="HQ.php" val1="HQ" urlparams="1"></csaction>					<csaction name="4c09f13" class="Goto Link" type="onevent" val0="Calender.php" val1="Calende" urlparams="1"></csaction>					<csaction name="4c60fa4" class="Goto Link" type="onevent" val0="Links.php" val1="Links" urlparams="1"></csaction>					<csaction name="4cca145" class="Goto Link" type="onevent" val0="Contact.php" val1="Contact" urlparams="1"></csaction>					<csaction name="4d20916" class="Goto Link" type="onevent" val0="help.php" val1="help" urlparams="1"></csaction>					<csaction name="4c35660" class="Goto Link" type="onevent" val0="wordpress/" val1="WP" urlparams="1"></csaction>				</csactions>				<csactiondict>					<script type="text/javascript"><!--CSAct[/*CMP*/ '4559d80'] = new Array(CSGotoLink,/*URL*/ 'index.php','Index');CSAct[/*CMP*/ '4a8cf61'] = new Array(CSGotoLink,/*URL*/ 'http://ogmmj.Forumer.com','Forumer');CSAct[/*CMP*/ '4baf2e2'] = new Array(CSGotoLink,/*URL*/ 'HQ.php','HQ');CSAct[/*CMP*/ '4c09f13'] = new Array(CSGotoLink,/*URL*/ 'Calender.php','Calende');CSAct[/*CMP*/ '4c60fa4'] = new Array(CSGotoLink,/*URL*/ 'Links.php','Links');CSAct[/*CMP*/ '4cca145'] = new Array(CSGotoLink,/*URL*/ 'Contact.php','Contact');CSAct[/*CMP*/ '4d20916'] = new Array(CSGotoLink,/*URL*/ 'help.php','help');CSAct[/*CMP*/ '4c35660'] = new Array(CSGotoLink,/*URL*/ 'wordpress/','WP');// --></script>				</csactiondict>				<script type="text/javascript">		function startTime()		{		var today=new Date()		var h=today.getHours()		var m=today.getMinutes()		var s=today.getSeconds()		var 		// add a zero in front of numbers<10		m=checkTime(m)		s=checkTime(s)		h=checkTime(h)		document.getElementById('clock').innerHTML="Time"+":"+" "+h+":"+m+":"+s+" "+" "		t=setTimeout('startTime()',500)		}		function checkTime(i)		{		if (i<10)  		 {i="0" + i} 		 return i		}		</script>				<link title="CSS" href="GeneratedItems/CSScriptLib.js">			<!-- #EndHeadLocked -->		</head>		<body bgcolor="#7e7c7c" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" onload="startTime()">			<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#333333" height="244">				<tr>					<td width="10" background="BG/Header.jpg">						<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">							<tr>								<td><a id="Name">Grade</a><a id="Name2">.11</a></td>								<td></td>							</tr>							<tr>								<td></td>								<td></td>							</tr>							<tr>								<td><a id="spon">Sponsered By Joesph Kaleel</a></td>								<td></td>							</tr>						</table>					</td>				</tr>			</table>			<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#3d4b49" background="BG/Tag_01.gif" height="50">				<tr>					<td>						<div align="left">							<a id="_top"></a><a onclick="CSAction(new Array(/*CMP*/'4559d80'));return CSClickReturn()" href="#" target="Index" csclick="4559d80"><img id="navico"src="icons/home.png" alt="HomePage" width="30" height="30" border="0"></a>		<a onclick="CSAction(new Array(/*CMP*/'4a8cf61'));return CSClickReturn()" href="#" target="Forumer" csclick="4a8cf61"><img id="navico2" src="icons/Forumer.png" alt="Froumer"  width="30" height="30" border="0"></a>					<a onclick="CSAction(new Array(/*CMP*/'4baf2e2'));return CSClickReturn()" href="#" target="HQ" csclick="4baf2e2"><img id="navico3" src="icons/HQ.png" alt="HQ" width="30" height="30" border="0"></a>					<a onclick="CSAction(new Array(/*CMP*/'4c09f13'));return CSClickReturn()" href="#" target="Calender" csclick="4c09f13"><img id="navico4" src="icons/Calender.png" alt="Calender" width="30" height="30" border="0"></a>					<a onclick="CSAction(new Array(/*CMP*/'4c60fa4'));return CSClickReturn()" href="#" target="Links" csclick="4c60fa4"><img id="navico5" src="icons/links.png" alt="Links" width="30" height="30" border="0"></a>					<a onclick="CSAction(new Array(/*CMP*/'4cca145'));return CSClickReturn()" href="#" csclick="4cca145"><img id="navico6" src="icons/Contact.png" alt="Contact" width="30" height="30" border="0"></a>					<a onclick="CSAction(new Array(/*CMP*/'4d20916'));return CSClickReturn()" href="#" target="help" csclick="4d20916"><img id="navico7" src="icons/Help.png" alt="Help" width="30" height="30" border="0"></a><a onclick="CSAction(new Array(/*CMP*/'4c35660'));return CSClickReturn()" href="#WP" target="WP" csclick="4c35660"><img id="navico8" src="external/WebCoding.png" alt="Blog" width="35" height="35" border="0"></a></div>					</td>				</tr>			</table>			<table width="100%" border="0" cellspacing="0" cellpadding="0" align="right">				<tr>					<td><a class="p"><?php							 if (isset($_COOKIE["Guest"])) 							 echo "Welcome " . $_COOKIE["Guest"];								else							 echo "Welcome guest!";							?></a></td>					<td>						<Div align="right">							<a id="clock" ></a></div>					</td>				</tr>			</table>			<br>			<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#333333" height="81">				<tr height="5">					<td bgcolor="#333333" height="5"></td>				</tr>				<tr height="20">					<td rowspan="4" bgcolor="#999999" height="80"><!-- #BeginEditable "1" -->							<div align="left">								<form action="insertmail.php" method="post">										User: <input type="text" name="user" /> Password: <input type="text" name="Pass" /> <input type="submit" />								</form>							</div>						<!-- #EndEditable --></td>				</tr>				<tr height="20">							</tr>				<tr height="20">							</tr>				<tr height="20">							</tr>				<tr height="50">					<td bgcolor="#999999" height="50"><a href="#_top" id="ttt">Top</a></td>				</tr>			</table>			<br>			<div align="center" class="p">				<!--Creative Commons License--><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.5/"><img'>http://creativecommons.org/licenses/by-nc-nd/2.5/"><img alt="Creative Commons License" style="border-width: 0" src="http://i.creativecommons.org/l/by-nc-nd/2.5/88x31.png"/></a><br/>				<a>This work is licensed under a </a><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/2.5/" target="CC">Creative Commons Attribution-Noncommercial-No Derivative Works 2.5  License</a>.		<!--/Creative Commons License--><!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://forums.xisto.com/no_longer_exists/; xmlns:rdfs="http://http://www.w3.org/2000/01/rdf-schema;	<Work rdf:about="">		<license rdf:resource="http://creativecommons.org/licenses/by-nc-nd/2.5/" />	</Work>	<License rdf:about="http://creativecommons.org/licenses/by-nc-nd/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><prohibits rdf:resource="http://web.resource.org/cc/CommercialUse"/></License></rdf:RDF> --></div>		</body>	<!-- InstanceEnd --></html>

the in put:
<form action="insertmail.php" method="post">										User: <input type="text" name="user" /> Password: <input type="text" name="Pass" /> <input type="submit" />								</form>

and the insertmail.php
<div align="left">								<form action="insertmail.php" method="post">										User: <input type="text" name="user" /> Password: <input type="text" name="Pass" /> <input type="submit" />								</form>							</div>

and 1 more thing i had made a template lately and would like you to have a look at and tell me your opinon.



1more thing :
dont copy the code i have (CC)right reserve on it ... :) :) :) :)




joe.k
Edited by joe.k (see edit history)

Share this post


Link to post
Share on other sites

and 1 more thing i had made a template lately and would like you to have a look at and tell me your opinon.

Completely off-topic, but, yes, I like your template. I guess that there will be some text between "Welcome" and "top". By the way, what does "Grade .11" stand for ?And, no, I will not steal your code, at least not as long as it will not be fully operationnal! :):):)

Share this post


Link to post
Share on other sites

You mention the code insert.php This seems to be the problem piece of code, but you have not provided us with any of the code from that file. Without any code to work on, we can only offer uneducated guesses, which can be as harmful as helpful. Perhaps if you provided the code, or at least the significant portions of the code.~Viz

Share this post


Link to post
Share on other sites

And, no, I will not steal your code, at least not as long as it will not be fully operationnal!


i was just kidding... iam a PHP and SQL newbie

@ ok1

Close all opened tags. To topic maker.

there's no open tags



and for the insertmail.php i have post the code line :
(i dont have to post you the full page ,do i?? anyway ...)


*** the insertmail.php file code: (register)

<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#333333" height="81">				<tr height="5">					<td bgcolor="#333333" height="5"></td>				</tr>				<tr height="20">					<td rowspan="4" bgcolor="#999999" height="80"><!-- #BeginEditable "1" -->							<p><?php$con = mysql_connect("localhost","Guest","");if (!$con)  {  die('Could not connect: ' . mysql_error());  }mysql_select_db("my_db", $con);  $sql="INSERT INTO User (User, Password)VALUES('$_POST[user]','$_POST[Pass]'))";if (!mysql_query($sql,$con))  {  die('Error: ' . mysql_error());  }echo "thank you!!,You Registeration Request has been end to the admin";mysql_close($con)?></p>						<!-- #EndEditable --></td>				</tr>				<tr height="20">							</tr>				<tr height="20">							</tr>				<tr height="20">							</tr>				<tr height="50">					<td bgcolor="#999999" height="50"><a href="#_top" id="ttt">Top</a></td>				</tr>			</table>

and i tried to complete the coding and add login code and login cookies and sessions but ended up with a complete disaster..
"phrases errors ,aql and mail() function errors)"

and it seem i dont completely understood the login and registration method and how dose it exactly work,
please advise me with you wisdom in php and SQL coding :) :)


PS: have a super new year eve :)
Edited by joe.k (see edit history)

Share this post


Link to post
Share on other sites

i was just kidding... iam a PHP and SQL newbie
@ ok1

there's no open tags
and for the insertmail.php i have post the code line :
(i dont have to post you the full page ,do i?? anyway ...)
*** the insertmail.php file code: (register)

<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#333333" height="81">				<tr height="5">					<td bgcolor="#333333" height="5"></td>				</tr>				<tr height="20">					<td rowspan="4" bgcolor="#999999" height="80"><!-- #BeginEditable "1" -->							<p><?php$con = mysql_connect("localhost","Guest","");if (!$con)  {  die('Could not connect: ' . mysql_error());  }mysql_select_db("my_db", $con);  $sql="INSERT INTO User (User, Password)VALUES('$_POST[user]','$_POST[Pass]'))";if (!mysql_query($sql,$con))  {  die('Error: ' . mysql_error());  }echo "thank you!!,You Registeration Request has been end to the admin";mysql_close($con)?></p>						<!-- #EndEditable --></td>				</tr>				<tr height="20">							</tr>				<tr height="20">							</tr>				<tr height="20">							</tr>				<tr height="50">					<td bgcolor="#999999" height="50"><a href="#_top" id="ttt">Top</a></td>				</tr>			</table>

and i tried to complete the coding and add login code and login cookies and sessions but ended up with a complete disaster..
"phrases errors ,aql and mail() function errors)"

and it seem i dont completely understood the login and registration method and how dose it exactly work,
please advise me with you wisdom in php and SQL coding :) :)
PS: have a super new year eve :)

What would be an easier way is to just use a config file because then on top of the php script if you have lots of them you just put

<?
ob_start();
include("config.php");
?>
Which would connect to the config file which is connected to your database which makes the whole thing much easier.

Also, you can have <? to open and ?> to close, not always <?php and ?>

Hope this helps

If you need the config coding tell me.

-Lewis

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.