Jump to content

Greysoul

Members
  • Content Count

    117
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Greysoul

  • Rank
    Member
  1. thanks, tried searching it but thats like finding a needle in a haystack
  2. this might be a silly question but i get a mysql error in my php query if my table is named 0111, but if i change it to 0111bills it works...is there a reason for this?
  3. yeah i see now, i'll fix it, thanks
  4. i remember trying to do it and getting errors, so i took them out and it worked. i was more than likely putting them in wrong. if it works, then is it required?
  5. i'm sort of a beginner, i don't even know what a delimiter is
  6. fixed, my count variable wasn't up there..FINALLY lol.
  7. $con = mysql_connect("localhost","dbusername","dbpass");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("dbname", $con);
  8. don't like stumping people
  9. yeah lol. and i mean there's some obvious changes in things, but i'm just not sure what would keep it from functioning..its probably something small left out or something thats stopping it from working that i added
  10. how? one uses bills and one uses row..same thing defined i believe..unless you are typing about something else
  11. seems as if every time i get something working i break something else. i have my main page that i display everything but i also always make a test.php to test things with. anyway...on my main page my check boxes delete fine..but on my new page that i've changed some things on..it doesn't work..1. the array for the delete box to display is the same2. the button is the same3. the query is the samei can't find the problem! ignore any changes with the table and other variables as thats working fine, i was changing some things with the updating porition..its just the deleting portion. whats different between the two?page where delete works <form name='william' method='post' action=''><?php$bills="SELECT * FROM bills WHERE Owner = 'Both' OR Owner = 'William' ORDER BY Owner,DueDate";$result=mysql_query($bills);$count=mysql_num_rows($result);$x=0;while($row = mysql_fetch_array($result)) {$x++;echo "<tr><th class='centerbox'>" . "<input name='checkbox[]' type='checkbox' id='checkbox[]' value='" . $row['ID'] . "'>" . "</th><input type='hidden' size='10' name='id[$x]' class='form' value='" . $row['ID'] . "'><th>" . "<input type='text' size='10' name='wname[$x]' class='form' value='" . $row['Name'] . "'>" . "</th><td>" . "<input type='text' size='10' name='wpa[$x]' class='form' value='$" . $row['ProjAmnt'] . "'>" . "</td><td>" . "<input type='text' size='10' name='waa[$x]' class='form' value='$" . $row['ActAmnt'] . "'>" . "</td><td>" . "<input type='text' size='10' name='wdd[$x]' class='form' value='" . $row['DueDate'] . "'>" . "</td><td>" . "<input type='text' size='10' name='wc[$x]' class='form' value='" . $row['Company'] . "'>" . "</td>";if($row['PayMethod'] != check)echo "<td>" . '<a href="' . $row['PayMethod'] . '" target=_blank>' . 'Website </a>' . "</td></tr>";elseecho "<td>" . "Check" . "</td></tr>";// ++$x; }$billtotals= mysql_query("SELECT SUM(ProjAmnt) AS projected, SUM(ActAmnt) AS actual FROM bills WHERE Owner = 'Both' OR Owner = 'William'");while($row = mysql_fetch_array($billtotals)) {$wbp=$row['projected'];$wba=$row['actual'];echo "<tr><th>" . "<input name='delete' class='button' type='submit' id='delete' value='DEL'>" . "</th><th>" . "Totals" . "</th><td>" . "$" . number_format($row['projected'],2) . "</td><td>" . "$" . $row['actual'] . "</td><th colspan='3' class='buttonbox'>" . "<input name='update' class='button' type='submit' id='update' value='Update'>" . "</th></tr></form>"; } page where it doesn't work <form name='update' method='post' action=''><table><tr><th colspan="2" class="centerbox">William's Bills</th><th colspan="5"> </th></tr><tr><th class='centerbox'><input type="checkbox" name="sAll" onClick="selectAll(this)" /></th><th>Bills</th><th>Project Amt</th><th>Actual Amnt</th><th>Due Date</th><th>Company</th><th>Pymnt Method</th></tr><?php$result = mysql_query("SELECT * FROM bills");$i = 0;while ($bills = mysql_fetch_array($result)) {echo "<input type='hidden' name='id[$i]' value='{$bills['ID']}'>";echo "<tr><th class='centerbox'>" . "<input name='checkbox[]' type='checkbox' id='checkbox[]' value='" . $bills['ID'] . "'>" . "</th><td><input type='text' size='15' class='form' name='name[$i]' value='{$bills['Name']}'></td><td><input type='text' size='15' class='form' name='projamnt[$i]' value='{$bills['ProjAmnt']}'></td><td><input type='text' size='15' class='form' name='actamnt[$i]' value='{$bills['ActAmnt']}'></td><td><input type='text' size='15' class='form' name='duedate[$i]' value='{$bills['DueDate']}'></td><td><input type='text' size='15' class='form' name='company[$i]' value='{$bills['Company']}'></td>";if($bills['PayMethod'] != check)echo "<td>" . '<a href="' . $bills['PayMethod'] . '" target=_blank>' . 'Website </a>' . "</td></tr>";elseecho "<td>" . "Check" . "</td></tr>";++$i;}$billtotals= mysql_query("SELECT SUM(ProjAmnt) AS projected, SUM(ActAmnt) AS actual FROM bills WHERE Owner = 'Both' OR Owner = 'William'");while($row = mysql_fetch_array($billtotals)) {$wbp=$row['projected'];$wba=$row['actual'];echo "<tr><th>" . "<input name='delete' class='button' type='submit' id='delete' value='DEL'>" . "</th><th>" . "Totals" . "</th><td>" . "$" . number_format($row['projected'],2) . "</td><td>" . "$" . $row['actual'] . "</td><th colspan='3' class='buttonbox'>" . "<input name='update' class='button' type='submit' id='update' value='Update'>" . "</th></tr></form>"; } query that works on one page and not the other.. if($delete){$checkbox = $_POST['checkbox'];$delete = $_POST['delete'];for($i=0;$i<$count;$i++){$del_id = $checkbox[$i];$sql = "DELETE FROM bills WHERE ID='$del_id'";$result = mysql_query($sql);}if($result){echo "<meta http-equiv=\"refresh\" content=\"0;URL=test.php\">";}}
  12. its only echo'n the first 7 ID's in my information, and it is letting me update them and change them how i want. why only 7 and not the whole table? lol
  13. hows that? seems to work pretty good, dunno if its "correct" lol. its printing the ID's in my echo ... names appear to be printing in the echo as well, just not taking to the DB
  14. again, i know there has to be an ID associated with the records, thats what i want. i don't mind if its in the source, i just don't want it displayed in my table. there's no reason for the user to see the ID's for the bill name..he just has no use for it and its taking up spacei just referred to myself in third person
×
×
  • Create New...