473,323 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Approving Items

I have recently set up most of my new site in PHP which i'm very happy
about but now i have hit a problem. I am now at the stage of making
admin's lives easier by making it so they can use a nice interface and
not phpMyAdmin to aurhorise submisions to the site.

I have created a page whereby the yet to be authenticated submitions
are shown to the admin with three radio boxes next to each submition
one to ban the user (ip address of) one to approve the submision and
the other is to delete the submition. I also have a button which
submits the form to itself.

But now I need to know how to process that as I dont know how to do a
loop that chceks what the radio option is and takes the appropriate
action. Because an admin could leave an option that must also be
allowed for as they may need to ask another admin about it so it could
be id 50, 54, 55, 56, 57, 60 etc and I dont know how to allow for that.

So if any of you could please help me with this matter I wouold really
appreciate it.

P.S.

To allow a comment the "approved" field has to be set to 1 instead of 2
and to delete it gets erased from the whole db and ban would put the ip
of the user into another ban list db.

But I can do that code, I just need the loop part and if possible that
if statement.

Oh and btw the options are named by the id of the submition ... but
this can be changed if necessary.

Thanks, James.

Oct 22 '06 #1
22 1345
James54321 wrote:
I have recently set up most of my new site in PHP which i'm very happy
about but now i have hit a problem. I am now at the stage of making
admin's lives easier by making it so they can use a nice interface and
not phpMyAdmin to aurhorise submisions to the site.

I have created a page whereby the yet to be authenticated submitions
are shown to the admin with three radio boxes next to each submition
one to ban the user (ip address of) one to approve the submision and
the other is to delete the submition. I also have a button which
submits the form to itself.

But now I need to know how to process that as I dont know how to do a
loop that chceks what the radio option is and takes the appropriate
action. Because an admin could leave an option that must also be
allowed for as they may need to ask another admin about it so it could
be id 50, 54, 55, 56, 57, 60 etc and I dont know how to allow for that.

So if any of you could please help me with this matter I wouold really
appreciate it.

P.S.

To allow a comment the "approved" field has to be set to 1 instead of 2
and to delete it gets erased from the whole db and ban would put the ip
of the user into another ban list db.

But I can do that code, I just need the loop part and if possible that
if statement.

Oh and btw the options are named by the id of the submition ... but
this can be changed if necessary.
Without you showing your code and HTML it's a bit hard to help you.

Here's an HTML file

<html>
<head><title>title</title></head>
<body>
<form action="" method="post">
submission 1
<label><input type="checkbox" name="id1" value="0" checked>No change</label>
<label><input type="checkbox" name="id1" value="1">Ban</label>
<label><input type="checkbox" name="id1" value="2">Approve</label>
<label><input type="checkbox" name="id1" value="3">Delete</label>
<br>
submission 42
<label><input type="checkbox" name="id42" value="0" checked>No change</label>
<label><input type="checkbox" name="id42" value="1">Ban</label>
<label><input type="checkbox" name="id42" value="2">Approve</label>
<label><input type="checkbox" name="id42" value="3">Delete</label>
<br>
<input type="submit">
</form>
</body>
</html>

When the server receives this form it will have $_POST['id1'] and
$_POST['id42'] set to one of 0, 1, 2, or 3 (unless the client chose to
lie to the server).
You can check the keys and values with

<?php
foreach ($_POST as $key=>$value) {
if (preg_match('/^id(\d+)$/', $key, $mat)) {
switch ((int)$value) {
case 0: /* void */ break;
case 1: submission_ban($mat[1]); break;
case 2: submission_approve($mat[1]); break;
case 3: submission_delete($mat[1]); break;
default: /* client is lying */ break;
}
}
}
?>

Happy Coding :)
--
File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

I don't check the dodgeit address (very often).
If you *really* need to mail me,
use the address in the Reply-To header.
Oct 22 '06 #2
Pedro Graca wrote:
James54321 wrote:
>>I have recently set up most of my new site in PHP which i'm very happy
about but now i have hit a problem. I am now at the stage of making
admin's lives easier by making it so they can use a nice interface and
not phpMyAdmin to aurhorise submisions to the site.

I have created a page whereby the yet to be authenticated submitions
are shown to the admin with three radio boxes next to each submition
one to ban the user (ip address of) one to approve the submision and
the other is to delete the submition. I also have a button which
submits the form to itself.

But now I need to know how to process that as I dont know how to do a
loop that chceks what the radio option is and takes the appropriate
action. Because an admin could leave an option that must also be
allowed for as they may need to ask another admin about it so it could
be id 50, 54, 55, 56, 57, 60 etc and I dont know how to allow for that.

So if any of you could please help me with this matter I wouold really
appreciate it.

P.S.

To allow a comment the "approved" field has to be set to 1 instead of 2
and to delete it gets erased from the whole db and ban would put the ip
of the user into another ban list db.

But I can do that code, I just need the loop part and if possible that
if statement.

Oh and btw the options are named by the id of the submition ... but
this can be changed if necessary.


Without you showing your code and HTML it's a bit hard to help you.

Here's an HTML file

<html>
<head><title>title</title></head>
<body>
<form action="" method="post">
submission 1
<label><input type="checkbox" name="id1" value="0" checked>No change</label>
<label><input type="checkbox" name="id1" value="1">Ban</label>
<label><input type="checkbox" name="id1" value="2">Approve</label>
<label><input type="checkbox" name="id1" value="3">Delete</label>
<br>
submission 42
<label><input type="checkbox" name="id42" value="0" checked>No change</label>
<label><input type="checkbox" name="id42" value="1">Ban</label>
<label><input type="checkbox" name="id42" value="2">Approve</label>
<label><input type="checkbox" name="id42" value="3">Delete</label>
<br>
<input type="submit">
</form>
</body>
</html>

When the server receives this form it will have $_POST['id1'] and
$_POST['id42'] set to one of 0, 1, 2, or 3 (unless the client chose to
lie to the server).
You can check the keys and values with

<?php
foreach ($_POST as $key=>$value) {
if (preg_match('/^id(\d+)$/', $key, $mat)) {
switch ((int)$value) {
case 0: /* void */ break;
case 1: submission_ban($mat[1]); break;
case 2: submission_approve($mat[1]); break;
case 3: submission_delete($mat[1]); break;
default: /* client is lying */ break;
}
}
}
?>

Happy Coding :)
One change I would make to this:

<label><input type="checkbox" name="id[42]" value="1">Ban</label>

etc.

Notice the 42 is a subscript. Then you can do things like:

$id = $_POST['id']'
foreach ($id as $key=>$value) {
// No pregmatch needed

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 22 '06 #3
Firstly WOW thank you for both responding so quickly and secondly here
is my code:
<?php
include('../config.php');
//include('../head.php');
echo("<body bgcolor=\"lightblue\">");
echo("<title>approval</title>");
//include('links.php');

function displayIdeas($result)
{

echo("<form method=\"post\">");

print "\n<table border=\"1\">\n<tr>\n" .
"\n\t<th>Approve</th>" .
"\n\t<th>Delete</th>" .
"\n\t<th>Ban</th>" .
"\n\t<th>Idea ID</th>" .
"\n\t<th>Idea Name</th>" .
"\n\t<th>Category</th>" .
"\n\t<th>Idea</th>" .
"\n\t<th>Time Submitted</th>" .
"\n\t<th>Date Submitted</th>" .
"\n\t<th>User</th>" .
"\n\t<th>IP Address</th>" .
"\n</tr>";

while($row = mysql_fetch_row($result)) {
list($ID,$Idea_Name,$Category,$Idea,$Time,$Date,$U ser,$IP_Address) =
$row;
{

if ($rowcounter == '1') {

print "\n<tr bgcolor=\"yellow\">";

$rowcounter = '2';
} else {

print "\n<tr bgcolor=\"lightblue\">";

$rowcounter = '1';
}

print "\n\t<td><center><input type=\"radio\" name=\"$ID\"
value=\"Approve\" /></center></td>";

print "\n\t<td><center><input type=\"radio\" name=\"$ID\"
value=\"Delete\" /></center></td>";

print "\n\t<td><center><input type=\"radio\" name=\"$ID\"
value=\"Ban\" /></center></td>";

foreach($row as $data)

print "\n\t<td{$data} </td>";

print "\n</tr>";

}
}

print "\n</table>\n";
echo("<input type=\"submit\" name=\"submit\"
value=\"Go\"></td></form>");
}

$query = "SELECT ID,Idea_Name,Category,Idea,Time,Date,User,IP_Addre ss
FROM ideas WHERE Approved = 0 AND Category != 'ADMIN' Order by 'id'
ASC";

if (!($conn = @ mysql_connect($host,$user,$pass)))
die("Cannot Connect");

if (!(mysql_select_db($db,$conn)))
showerror();

if(!($result = @ mysql_query ($query)))
showerror();

displayIdeas($result);

mysql_close($conn);

if (isset($_POST['submit'])) {

//this is where the code i need should go :)

// close connection
mysql_close($connection);
}

?>

Oct 22 '06 #4
btw i forgot to say that your code is great (afaik) but i dont quite
know what the bit after each case does ie the bit in between case1:
THIS BIT and break;
:S

Thanks, James.

Oct 22 '06 #5
James54321 wrote:
here is my code:
<?php
<snip>
print "\n\t<td><center><input type=\"radio\" name=\"$ID\"
value=\"Approve\" /></center></td>";
Make that

print "\n\t<td><center><input type=\"radio\" name=\"id[$ID]\"
value=\"Approve\" /></center></td>";
// ------------------------------------------------------^^^---^

<snip>
if (isset($_POST['submit'])) {

//this is where the code i need should go :)
forach ($_POST['id'] as $key =$value) {
// $key is now the ID from the database (unless the client lied to you)
// $value is the chosen option (unless the client lied to you)
// use them as you see fit
}
// close connection
mysql_close($connection);
}

?>
--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
Oct 22 '06 #6
James54321 wrote:
btw i forgot to say that your code is great (afaik) but i dont quite
know what the bit after each case does ie the bit in between case1:
THIS BIT and break;
:S
If I remember correctly from my last post you mean the function calls
with the id.

switch ($value) {
case 0: break;
case 1: submission_delete_or_whatever_it_was($key); break;
}

Well, that `submission_delete_or_whatever_it_was` is a function that
deletes (or something else) the submission of the id $key.

You are expected to code it :)
It will be something like

function submission_delete_or_whatever_it_was($id) {
$validated_id = (int)$id;
if ($validated_id < 1) return false;

$sql = "delete from TABLE where ID=$validated_id";

if (mysql_query($sql)) return mysql_affected_rows()
else return false;
}

--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
Oct 22 '06 #7
Thats great ty you two I can finally make it work :D woot :D

Thanks, James.

Oct 22 '06 #8
Drat, I tried to make the code work but it still does nothing after
clickig the "Go" button.

Heres what I have made so far and I cant personally see any problems
with it (but then again I have never done a foreach statement on
posts).

<?php
include('../config.php');
include('../head.php');
echo("<body bgcolor=\"lightblue\">");
echo("<title>approval</title>");
include('links.php');

function displayIdeas($result)
{

echo("<form method=\"post\">");

print "\n<table border=\"1\">\n<tr>\n" .
"\n\t<th>Approve</th>" .
"\n\t<th>Delete</th>" .
"\n\t<th>Ban</th>" .
"\n\t<th>Idea ID</th>" .
"\n\t<th>Idea Name</th>" .
"\n\t<th>Category</th>" .
"\n\t<th>Idea</th>" .
"\n\t<th>Time Submitted</th>" .
"\n\t<th>Date Submitted</th>" .
"\n\t<th>User</th>" .
"\n\t<th>IP Address</th>" .
"\n</tr>";

while($row = mysql_fetch_row($result)) {
list($ID,$Idea_Name,$Category,$Idea,$Time,$Date,$U ser,$IP_Address) =
$row;
{

if ($rowcounter == '1') {

print "\n<tr bgcolor=\"yellow\">";

$rowcounter = '2';
} else {

print "\n<tr bgcolor=\"lightblue\">";

$rowcounter = '1';
}

print "\n\t<td><center><input type=\"radio\" name=\"id[$ID]\"
value=\"Approve\" /></center></td>";

print "\n\t<td><center><input type=\"radio\" name=\"id[$ID]\"
value=\"Delete\" /></center></td>";

print "\n\t<td><center><input type=\"radio\" name=\"id[$ID]\"
value=\"Ban\" /></center></td>";
foreach($row as $data)

print "\n\t<td{$data} </td>";

print "\n</tr>";

}
}

print "\n</table>\n";
echo("<input type=\"submit\" name=\"submit\"
value=\"Go\"></td></form>");
}

$query = "SELECT ID,Idea_Name,Category,Idea,Time,Date,User,IP_Addre ss
FROM ideas WHERE Approved = 0 AND Category != 'ADMIN' Order by 'id'
ASC";

if (!($conn = @ mysql_connect($host,$user,$pass)))
die("Cannot Connect");

if (!(mysql_select_db($db,$conn)))
showerror();

if(!($result = @ mysql_query ($query)))
showerror();

displayIdeas($result);

mysql_close($conn);

if (isset($_POST['submit'])) {

//this is where the code i need should go :)

foreach ($_POST['id'] as $key =$value) {
switch ($value) {
case "Approve":
submission_approve($key); break;
case "Delete":
submission_delete($key); break;
case "Ban":
submission_ban($key); break;
default:
break;
}
}

//Well, that `submission_delete_or_whatever_it_was` is a function that
deletes (or something else) the submission of the id $key.

function submission_approve($id) {
$validated_id = $id;
// if ($validated_id < 1) return false;
echo("approved");
// open connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to
connect!");

// select database
mysql_select_db($db) or die ("Unable to select database!");

// create query
$query = "INSERT INTO temp (ID, type) VALUES
('$validated_id','approved')";

//replace sites with your table name
//replace address and description with the filed name

// execute query
$result = mysql_query($query) or die ("Error in query: $query.
".mysql_error());

// print message with ID of inserted record
echo "New record inserted at now it will now go to the approvers";

// close connection
mysql_close($connection);

}
function submission_delete($id) {
$validated_id = (int)$id;
// if ($validated_id < 1) return false;

// open connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to
connect!");

// select database
mysql_select_db($db) or die ("Unable to select database!");

// create query
$query = "INSERT INTO temp (ID, type) VALUES
('$validated_id','deleted')";

//replace sites with your table name
//replace address and description with the filed name

// execute query
$result = mysql_query($query) or die ("Error in query: $query.
".mysql_error());

// print message with ID of inserted record
echo "New record inserted at now it will now go to the approvers";

// close connection
mysql_close($connection);
}
function submission_ban($id) {
$validated_id = (int)$id;
if ($validated_id < 1) return false;

// open connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to
connect!");

// select database
mysql_select_db($db) or die ("Unable to select database!");

// create query
$query = "INSERT INTO temp (ID, type) VALUES
('$validated_id','banned')";

//replace sites with your table name
//replace address and description with the filed name

// execute query
$result = mysql_query($query) or die ("Error in query: $query.
".mysql_error());

// print message with ID of inserted record
echo "New record inserted at now it will now go to the approvers";

// close connection
mysql_close($connection);

}

}

//close connection
mysql_close($conn);
?>

Oct 23 '06 #9
James54321 wrote:
Drat, I tried to make the code work but it still does nothing after
clickig the "Go" button.

Heres what I have made so far and I cant personally see any problems
with it (but then again I have never done a foreach statement on
posts).
Did you check the contents of the $_POST variable to see if it contains
what you expect?

echo "<pre>\n";
print_r($_POST);
echo "</pre>\n";

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 23 '06 #10
It seems there was a problem with having the functions so i put the
code from them in the right places and it now works, but its really
messy now.. so if anyone knows what is wrong with them please tell me

Thanks, James.

Oct 23 '06 #11
James54321 wrote:
It seems there was a problem with having the functions so i put the
code from them in the right places and it now works, but its really
messy now.. so if anyone knows what is wrong with them please tell me
Your problem was that variables inside a function only belong to that
function unless declared global.

<?php
$a = 42;
$b = 24;
function print_number($number) {
global $b; // $b inside this function is the global $b

echo $number; // ok
echo $a; // not ok: $a here is internal to the function.
echo $b; // ok, $b was declared global
}

print_number(17);
?>

You were trying to reconnect to the database (why?) inside the functions

<?php
function submission_something($id) {
mysql_connect($user, $pass, $host); // here $user, $pass, and
// $host are internal
// variables
}

Either declare the variables global, pass them as parameters to the
function (better) or do not keep connecting throughtout the script (best).

<?php
// connect once!
// do your stuff, including calling submission_something()
// disconnect once!

function submission_something($id) {
$sql = "select from table where id=$id";
$resource = mysql_query($sql); // will use last connection
// ...
mysql_free_resource($resource);
}
?>

Happy Coding :)

--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
Oct 23 '06 #12
Ok I have modified it like you said but i still have the same problem
NONE of the code is executed (even the echo("something is said here");)
doesnt work so i dont think the function is being called corectly
....but I have no idea why ...if you do please tell me.

Below is my revised code:

<?php
//include('../config.php');
include('../head.php');
echo("<body bgcolor=\"lightblue\">");
echo("<title>approval</title>");
include('../links.php');
echo("<BR><BR>");

// open connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to
connect!");

// select database
mysql_select_db($db) or die ("Unable to select database!");

displayIdeas();


function displayIdeas()
{
//funciton opened

// create query
$query = "SELECT ID,Idea_Name,Category,Idea,Time,Date,User,IP_Addre ss
FROM ideas WHERE Approved = 0 AND Category != 'ADMIN' Order by 'id'
ASC";

//replace sites with your table name
//replace address and description with the filed name

// execute query
$result = mysql_query($query) or die ("Error in query: $query.
".mysql_error());

echo("<form method=\"post\">");

print "\n<table border=\"1\">\n<tr>\n" .
"\n\t<th>Approve</th>" .
"\n\t<th>Delete</th>" .
"\n\t<th>Ban</th>" .
"\n\t<th>Idea ID</th>" .
"\n\t<th>Idea Name</th>" .
"\n\t<th>Category</th>" .
"\n\t<th>Idea</th>" .
"\n\t<th>Time Submitted</th>" .
"\n\t<th>Date Submitted</th>" .
"\n\t<th>User</th>" .
"\n\t<th>IP Address</th>" .
"\n</tr>";

while($row = mysql_fetch_row($result)) {
list($ID,$Idea_Name,$Category,$Idea,$Time,$Date,$U ser,$IP_Address) =
$row;
{

if ($rowcounter == '1') {

print "\n<tr bgcolor=\"yellow\">";

$rowcounter = '2';
} else {

print "\n<tr bgcolor=\"lightblue\">";

$rowcounter = '1';
}

print "\n\t<td><center><input type=\"radio\" name=\"id[$ID]\"
value=\"Approve\" /></center></td>";

print "\n\t<td><center><input type=\"radio\" name=\"id[$ID]\"
value=\"Delete\" /></center></td>";

print "\n\t<td><center><input type=\"radio\" name=\"id[$ID]\"
value=\"Ban\" /></center></td>";
}

foreach($row as $data)

print "\n\t<td{$data} </td>";

print "\n</tr>";

}
print "\n</table>\n";
echo("<input type=\"submit\" name=\"submit\"
value=\"Go\"></td></form>");
}
//function closed


if (isset($_POST['submit'])) {

//this is where the code i need should go :)

foreach ($_POST['id'] as $key =$value) {
switch ($value) {
case "Approve":
submission_approve($key);
case "Delete":
submission_approve($key);
break;
case "Ban":
submission_ban($key);
break;
default:
echo"hi key = $key and value = $value";
break;
}
}


//Well, that `submission_delete_or_whatever_it_was` is a function that
deletes (or something else) the submission of the id $key.
//close connection
mysql_close($connection);

function submission_approve($key)
{
// create query
$query = "UPDATE ideas SET Approved = 1 WHERE ID = $key";

//replace sites with your table name
//replace address and description with the filed name

// execute query
$result = mysql_query($query) or die ("Error in query: $query.
".mysql_error());

// print message with ID of inserted record
echo ("Idea $id has been approved!<BR>");

}

function submission_delete($key)
{
// create query
$query = "DELETE FROM ideas WHERE ID = $key";

//replace sites with your table name
//replace address and description with the filed name

// execute query
$result = mysql_query($query) or die ("Error in query: $query.
".mysql_error());

// print message with ID of inserted record
echo ("Idea $id has been deleted!<BR>");

}

function submission_ban($key)
{
// create query
$query = "INSERT INTO temp (ID, type) VALUES ('$key','banned')";

//replace sites with your table name
//replace address and description with the filed name

// execute query
$result = mysql_query($query) or die ("Error in query: $query.
".mysql_error());

// print message with ID of inserted record
echo ("The IP address that submitted idea $id has been banned!<BR>");
}
}

?>

Oct 23 '06 #13
James54321 wrote:
Ok I have modified it like you said but i still have the same problem
NONE of the code is executed (even the echo("something is said here");)
doesnt work so i dont think the function is being called corectly
...but I have no idea why ...if you do please tell me.

Below is my revised code:
What do you see when you look at the source code for the page (in your
browser)?

Do you have a site where we can look at it?

BTW - you should really have an "action=..." in your form statement,
even if it points back at this page. Most browsers will fill it in if
you don't have it - but AFAIK there isn't a documented default action.

I don't think that's your problem, however.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 23 '06 #14

James54321 wrote:
Ok I have modified it like you said but i still have the same problem
NONE of the code is executed (even the echo("something is said here");)
doesnt work so i dont think the function is being called corectly
...but I have no idea why ...if you do please tell me.

Below is my revised code:
I took the liberty to reformat your code a little bit (!).
First pass through it was to indent properly.
Here's a very stripped down result:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

<?php
displayIdeas();

function displayIdeas()
{
while ($row = mysql_fetch_row($result)) {
{
if ($rowcounter == '1') {
} else {
}
}
foreach($row as $data) print "\n\t<td{$data} </td>";
}
}
//function closed

if (isset($_POST['submit'])) {
//this is where the code i need should go :)
foreach ($_POST['id'] as $key =$value) {
switch ($value) {
}
}

//close connection
mysql_close($connection);

function submission_approve($key)
{
}

function submission_delete($key)
{
}

function submission_ban($key)
{
}
}

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

What you have to do is move the functions to their right place in the
structure of the script. I like to have all functions at the top of the
file, but you can have them anywhere you prefer. Even better is to have
them in a separate file and include it in scripts that need those
functions.
You still use some variables that do not exist.
Add

error_reporting(E_ALL);

to the very top of your script, right after the <?php opening tag so
that PHP complains about them and you can correct the mistake
*INDENT* your code properly! It will help you tremendously.

--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
Oct 23 '06 #15
Ok I havent changed the code since my last post as i have been busy
doing some other things but if you want to look at the source code when
it loads just go here http://www.flavouredcandy.com/approval/ideas.php
please note as it is an admin tool It is locked out BUT I have set up a
temporary account so you can take a look the username is temp and the
pword is googlegroups

And to say again i doubt it is that its in the wrong place (the
functions) because even the echo didnt work when I commented all the
mysql stuff in the approval function so I very much doubt it is that
....but of course you know best.

Thanks, James.

Oct 24 '06 #16
OOPS sorry thats the page that works (doesnt use functions) the one
that doesnt work is the same directory BUT the page is ideas2.php

James54321 wrote:
Ok I havent changed the code since my last post as i have been busy
doing some other things but if you want to look at the source code when
it loads just go here http://www.flavouredcandy.com/approval/ideas.php
please note as it is an admin tool It is locked out BUT I have set up a
temporary account so you can take a look the username is temp and the
pword is googlegroups

And to say again i doubt it is that its in the wrong place (the
functions) because even the echo didnt work when I commented all the
mysql stuff in the approval function so I very much doubt it is that
...but of course you know best.

Thanks, James.
Oct 24 '06 #17
James54321 wrote:
OOPS sorry thats the page that works (doesnt use functions) the one
that doesnt work is the same directory BUT the page is ideas2.php
Add error_reporting(E_ALL) to your code.

<?php

### add error_reporting here
error_reporting(E_ALL);

### the rest (all of it) of your script
//include('../config.php');
include('../head.php');
--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
Oct 24 '06 #18
Ok I did that thank you but there is still no change and there arent
any errors displayed to me either (as i preume thats what that script
does).

Thanks, James.

Oct 24 '06 #19
James54321 wrote:
Ok I did that thank you but there is still no change and there arent
any errors displayed to me either (as i preume thats what that script
does).
Ok. I run your code with a few changes (the fewest I could make), and
took a screenshot of the result.

http://img2.freeimagehosting.net/ima...f2c99fb524.png

Please notice a "Call to undefined function submission_delete() ..." in
that screenshot.
Your code with my changes, signalled by '#' or '###' is available at

http://pastebin.co.uk/4577

--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
Oct 24 '06 #20
Thank you very much its just it really didnt give me an error but
anyway i will try your code in the morning and I really hope it works
like yours so thank you very much for that.

James.

Oct 24 '06 #21
So should i leave the # or ### in or take them out or delete what their
signalling?

Thanks, James.

Oct 24 '06 #22
James54321 wrote:
So should i leave the # or ### in or take them out or delete what their
signalling?
Study them!

1. the Xmysql_* functions
Don't worry about them; they're just a way to test database scripts
without "having" a database. Of course you're free to study and
change them.
Don't forget to replace all "Xmysql_*" by "mysql_*" when your code is
ready (and delete the Xmysql_* functions)

2. some # or ### comments I just wrote because I don't have your
includes. For these you should remove the #'s so that your files get
included.

3. Other comments are just my ideas when I was reviewing your code.
Delete the whole comment for these cases.
There's a modification to the code @ http://pastebin.co.uk/4581
I didn't test it thoroughly, just verified there were no uninitialized
variables and that the echo's worked.
Happy Coding :)

--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
Oct 25 '06 #23

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Donnal Walter | last post by:
The following method is defined in one of my classes: def setup(self, items={}): """perform setup based on a dictionary of items""" if 'something' in items: value = items # now do something...
4
by: mb | last post by:
what is the best way to do this: In a game I want to a class called "Items". This class will have the game items public class Items { public int Chair public int Table . . .and so on . . .
9
by: Alpha | last post by:
Hi, How can I set all the items in a listbox to be selected? I can't find a property or mehtod to do it so I thought I'll try using setselected method but I need to find out how many items are in...
2
by: dave | last post by:
This little problem is driving me nuts!! On my webform page I create 2 variables.. Protected p_dml As String = "I" Public Const mwv_id As Integer = 0 ' originally had mwv_id as Protected
21
by: StriderBob | last post by:
Situation : FormX is mdi child form containing 2 ListViews ListView1 contains a list of table names and 4 sub items with data about each table. ListView2 contains a list of the columns on each...
2
by: hsuntn | last post by:
I am grabbing Outlook MailItems using the Items property on my Outlook inbox. When I iterate through them, I notice that they are not ordered in ReceivedTime or CreationTime order. For example, ...
0
by: Brian Henry | last post by:
Since no one else knew how to do this I sat here all morning experimenting with this and this is what I came up with... Its an example of how to get a list of items back from a virtual mode list...
13
by: Joel Koltner | last post by:
Is there an easy way to get a list comprehension to produce a flat list of, say, for each input argument? E.g., I'd like to do something like: for x in range(4) ] ....and receive
13
by: PetterL | last post by:
I writing a program where I read menu items from a file. But I have problem when I click an menu item i want it to mark that one as checked but I cant access the menu object of that item to see...
2
by: mygirl22 | last post by:
Hi, I used this code to created 2 combo boxes General and Specific...and Only show Specific (Combo B) when Combo A is chosen..... What i need now is to know how to assign specific values to the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.