Welcome! Log In Create A New Profile

Advanced

Installation Problems

Posted by Anonymous User 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Re: Installation Problems
June 07, 2006 10:20PM
Managed to get apache, php and mysql talking to each other.

Now I am getting the message:

Out of range value adjusted for column 'cid' at row 1

each time I try to insert data into the tables with an auto-increment field.

I registered at experts-exchange, but without luck.

Phpmyadmin gives an error message about additional functions for linked tables being disabled. It allows me to set up the database, but does not recognise that the tables are linked. I set up the database through a php file, and am still having the same problem.

I have no idea what is going on.

Let's see what tomorrow holds.

Re: Installation Problems
June 09, 2006 12:14PM
Hi All

I spent alot of time getting this to work.
In the page where a student will input his student number to register for a course. I wanted a dynamic dropdown list reading all courses from the database table course. I got it working with the variable of course posted to the database.

My problem is that I dont want the course name posted i want the cid number posted. I know i have to put a select statement for the cid where cname = cname, but where do i put the select statement.


<?php require_once('Connections/Test.php'winking smiley; ?>
<?php
mysql_select_db($database_Test, $Test);
$query_DropDown = "SELECT * FROM course ORDER BY cname ASC";
$DropDown = mysql_query($query_DropDown, $Test) or die(mysql_error());
$row_DropDown = mysql_fetch_assoc($DropDown);
$totalRows_DropDown = mysql_num_rows($DropDown);
?><?php
include("C:\WebServer\FoxServ\www\UNISAProject\header.php"winking smiley;

//print_r($_POST);
$link = mysql_connect("localhost"winking smiley
or
die ("Connection to the MYSQL Server was unsuccessfull"winking smiley;
mysql_select_db('UniversityDatabase'winking smiley
or
die ("Cannot connect to the UniversityDatabase"winking smiley;
?>
<form method=post action='Update_Course_Registrations.php'>
<html>
<head>
<title>Student Registration Form</title>
</head>
<body>
<tr>
<td width="262"><p>Enter Name of Course
Course
<select name="select">
<option value="value" <?php if (!(strcmp("value", $row_DropDown['cname']))) {echo "selected=\"selected\"";} ?>></option> <?php
do {
?> <option value="<?php echo $row_DropDown['cname']?>"<?php
if (!(strcmp($row_DropDown['cname'], $row_DropDown['cname'])))
{echo "selected=\"selected\"";} ?>>
<?php echo $row_DropDown['cname']?>
</option> <?php }
while ($row_DropDown = mysql_fetch_assoc($DropDown));
$rows = mysql_num_rows($DropDown);
if($rows > 0) {
mysql_data_seek($DropDown, 0);
$row_DropDown = mysql_fetch_assoc($DropDown);
}
?> </select>
</p>

</tr>
<tr>
<td>Enter your Student Number
<input name='Student_number' type='text'></td>
<td>&nbsp;</td>
</tr>
<p align="center">&nbsp;</p>
<form name="form1" method="post" action="">
<input type="submit" name="Submit" value="Submit">
</form>
<p align="center">&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($DropDown);
?>

avatar
Mac
Re: Installation Problems
June 09, 2006 12:48PM
To populate a drop-down I'd do it as this.

I'm giving the logic here - not the code

<form>
<select>// this is outside the loop here under
<option>Select a course</option>

//start select query 2 get cnames and cid
select * from course order by cname ASC
// etc code in here
$row=mysql_num_rows;
$i=0;
while ($row < $i){

$cname= $row['//get cname
$cid= $row['//get cid

echo "<option value='$cid'>$cname</option>";


And try and post in the correct thread winking smiley

$i++;
}

</select>
</form>


echo "<option value='$cid'>$cname</option>"; says it all - you echo the cname in the drop-down, but post the cid.

Difficult to guide since I'm not sure of your flow of pages.
Re: Installation Problems
June 10, 2006 08:37AM
I'm back.

Managed to get everything working as it should be, but found a strange thing with respect to the way php and mysql interact, which I am still trying to figure out.

Anyway, I lost 5 days trying to get my setup going again.

Back to work.

Sorry, you do not have permission to post/reply in this forum.