1,075,633 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Latest Posts in PHP

i first changed some fields from varchar to text (i had 4 fields varchar(500)) but the result was the same
i also changed the magazine table using

ALTER TABLE magazine
    ENGINE=InnoDB
    ROW_FORMAT=COMPRESSED 
    KEY_BLOCK_SIZE=8;

nothing yet.

It is important to notice that i dont have access to server to change settings in .ini or . conf files

I am waiting for a solution from u. Is there any? What r u proposing to do?

dourvas
Light Poster
37 posts since Dec 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Yes, the error reporting helped. I feel stupid that i did not thought it myself

the message

Error - Could not perform the query: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.

I am not sure what i will do next but its a good start. i am not sure about ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED.
if you have anysuggestions i am listening...

dourvas
Light Poster
37 posts since Dec 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

minitauros - thanks, that was actually commented out in my code. It's from a previous attempt!

Paul, I changed the fclose($handle), thanks for that. I'm still getting this multiple entry story! Your results are exactly what I would expect!
There are 72 records already in the table, adding 39, I would expect 101 records.... 852??

3842b841bbe5530fb40cd130b38142b8d0582c070f432f14c62c5e698a308a01

Attachments Screen_Shot_2013-05-19_at_7.58_.15_AM_.png 161.09KB Screen_Shot_2013-05-19_at_7.57_.08_AM_.png 71.64KB
RoryGren
Junior Poster in Training
71 posts since Oct 2007
Reputation Points: 12
Solved Threads: 11
Skill Endorsements: 0

I have a problem want to be solved.
I have three pages. page1.php, page2.php
page1.php has a form with two text field. one text field is for name and another is for number. there is a submit button and a "next" button too. using session I want show given name into page2.php and create checkboxes that according to given number. (e.g if I write 4 in number text field in page1.php then 4 checkboxes will appear in page2.php, if 8 then 8 checkboxes.

I want solve this problem using session.

page1.php

<body>
<p>
        <?php
session_start(); 
?>
      </p>
      <form id="form1" name="form1" method="post" action="">
        <p>
          <label for="name">Name</label>
          <input type="text" name="name" id="name" />
        </p>
        <p>
          <label for="number">Number</label>
          <input type="text" name="number" id="number" />
        </p>
        <p>
          <input type="submit" name="submit" id="submit" value="SEND" />
        </p> <br/>
        <a href="page2.php"> next </a>
      </form>

<?php      
if(isset($_POST['submit']))
{
$_SESSION['Name'] = $_POST['name'];
$_SESSION['Number'] = $_POST['number'];
}

$nname = $_SESSION['Name'];
$nnumber = $_SESSION['Number'];
echo $nname . $nnumber;

?>

</body>

page2.php

<body>


      <p>
        <?php
session_start(); 



echo $_SESSION['Number'] . $_SESSION['Name'];

$nName = $_SESSION['Name'];
$nNumber = $_SESSION['Number'];

?>
  </p>
      <form name="form1" method="post" action="">
        <input type="text" name="first_name" value="<?php  echo $nName; ?>" />
        <input type="checkbox" name="<?php for($i=0; $i< $nNumber; $i++)
        echo $i;
         ?>" value="<?php for($i=0; $i< $nNumber; $i++)
        echo $i;
         ?>" />
      </form>
      <p> <br/>
        <a href="page1.php">Back</a></p>
</body>
rubai
Light Poster
25 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

I need to use javascript so that when the one radio button is selected nothing happens but if the other one is (for example, Cheque) it will then validate the field (Cheque Number)..

dina85
Newbie Poster
7 posts since May 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

So does your "OR die(...)" function get triggered, or does it pass that? Maybe your query did not return any results?

minitauros
Posting Whiz in Training
286 posts since Apr 2011
Reputation Points: 45
Solved Threads: 46
Skill Endorsements: 4

Hi,

I've had a look through the forum(s), however, can't seem to find a solution to my issue (and I don't understand the PHP Manual).

Basically, got a website linked to a database, trying to pull data from one table and display onto the website where appropriate.

I have the following code:

<?php
    include "console/include/code/common.php";  
    //Connect to Database
    DBConnect();
    $Link = mysql_connect(dbhost,user,password);?>

    $Query = "SELECT * FROM database.tablename WHERE eventDay=1";
    $Result = mysql_query ($Query, $Link) or die (mysql_error($Link));

    //ON Debugging - code stops here resulting in Resource ID #3 - suggesting there is a problem
    with the $Result. However, please check the following code to see if there are errors (if poss).

    $Rows=mysql_num_rows($Result) or die (mysql_error($Rows));
    $loop=0;
    while ($loop<$Rows){
            //Add all variables to the output loop.
            $eventVisible=mysql_result($Result,$loop,"eventVisible");
            $eventDay=mysql_result($Result,$loop,"eventDay");
            $eventImagePath=mysql_result($Result,$loop,"eventImagePath");
            $eventTitle=mysql_result($Result,$loop,"eventTitle");
            $eventInfo=mysql_result($Result,$loop,"eventInfo");
            $expiryYear=mysql_result($Result,$loop,"expiryYear");
            $expiryMonth=mysql_result($Result,$loop,"expiryMonth");
            $expiryDay=mysql_result($Result,$loop,"expiryDay");
        //Print out the values into a table
    }

    if($eventVisible==1){
        //EVENT VISIBLE
            date_default_timezone_set('Europe/London');
                if(mktime() < mktime(23,59,59,$expiryMonth,$expiryDay,$expiryYear)) {
                //Event is before expiry?>
                <img src="<?php echo $eventImagePath;?>" width="160" height="160" style="float:left"/> <p><b><?php echo $eventTitle;?></b><p><font color="#000"><?php echo $eventInfo;?></font>   
                <?php }; ?>
        <?php };?>
        <br clear="all">  
        <br>
        <?php
        //Increment the loop by 1 - so we actually get to an end!
        $loop++;
        //};?>
    </div>

This code is for one tab - there are 6, so i simply copy the code, and change the query based on the tab that's selected.
As you can probably tell, I've tried to cut down and explain the code as much as possible - any questions though, feel free to ask.

maharrington
Newbie Poster
1 post since May 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0
minitauros
Posting Whiz in Training
286 posts since Apr 2011
Reputation Points: 45
Solved Threads: 46
Skill Endorsements: 4

Hi we don't spoon feed people here this is a site for learning and developing your self. We help you to learn so you can intern teacher other here. So my advice to you is try to code some thing and when you run into problems then you can post the code and the problem here and we will be more than ready to help you thank you.

otengkwaku
Junior Poster in Training
88 posts since Mar 2012
Reputation Points: 23
Solved Threads: 1
Skill Endorsements: 8

Yes and you could var_dump() your query statements to see if they contain all required data. E.g.:

var_dump("UPDATE magazine_tmp SET arth7='$arthro7', author7='$author7', title7='$title7', checked7='ok' where year='$year' and month='$month'");

minitauros
Posting Whiz in Training
286 posts since Apr 2011
Reputation Points: 45
Solved Threads: 46
Skill Endorsements: 4

Hi,

Try adding some error reporting to the query that is failing ($quer_up1). Add an 'or die' command.

$quer_up1=mysql_query("UPDATE magazine SET arth7='$arthro7', author7='$author7', title7='$title7', im7='Yes', checked7='ok' where year='$year' and month='$month'") or die('Error - Could not perform the query: ' . mysql_error());

Zagga
Posting Whiz
366 posts since Dec 2009
Reputation Points: 45
Solved Threads: 77
Skill Endorsements: 4

Sorry, I ran your code five times and every time was successful. The only thing that did error was your fclose - you need to change it to fclose($handle);

Attachments swimming-data.jpg 107.44KB
paulkd
Junior Poster in Training
99 posts since Aug 2007
Reputation Points: 21
Solved Threads: 19
Skill Endorsements: 0

how can i find out why this update wont work. What should i do?

dourvas
Light Poster
37 posts since Dec 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

I got it to work. I had to switch

$("#messages").append(
    "<div class='msg "+ type +"'>"+ msg +"</div>"
);

to

$("#chat").append(
    msg
);

and i forgot to show my scond file but i had a <br> at the end which messed it up so i had to move it to the beggining.

zacharysr
Light Poster
29 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Oh. right. You could do a FULLTEXT search on your DB if you want to do that, but it won't search any static text on any of your pages. I still think that a Google CSE search would be your best bet. Perservere with it for a while?

diafol
Keep Smiling
Moderator
10,625 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,506
Skill Endorsements: 57

Why are there two exactly the same lines like this:

$query = $con->prepare("INSERT INTOkzn_upcoming(meet_name,location,start_date) VALUES (?, ?, ?)");

? :) One on line 14 and one on 37, while you seem to be only using one. Could you try removing one ;)? Not sure if it will matter but just to be sure.

minitauros
Posting Whiz in Training
286 posts since Apr 2011
Reputation Points: 45
Solved Threads: 46
Skill Endorsements: 4

hii can any give me a php code that converts a csv file to an excel file

gvsamrat
Newbie Poster
1 post since May 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

i googled var_dump and i just used it. this is the code:

    elseif  ($flag==1 & $flag1==1)     
       { 
           //update magazine_tmp
       $quer_up=mysql_query("UPDATE magazine_tmp SET arth7='$arthro7', author7='$author7', title7='$title7', checked7='ok' where year='$year' and month='$month'"); 
       //update magazine
        $quer_up1=mysql_query("UPDATE magazine SET arth7='$arthro7', author7='$author7', title7='$title7', im7='Yes', checked7='ok' where year='$year' and month='$month'"); 

        echo var_dump( $quer_up)."<br>"; 
         echo var_dump( $quer_up1)."<br>"; 
         mysql_close();
       ///      header('Location: arthro7.php?info='.$year.$month.$user);
            exit();     

       }

the echo results:
bool(true)
bool(false)

the tables magazine_tmp and magazine have the same structure. By the time this code executes some fields have data of one table and some fielda of the other - not necessary the same.
when i copy the sql statment that wont execute and pasted it into phpmyadmin and executed it there it worked...

dourvas
Light Poster
37 posts since Dec 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Paul, the following is tha actual data:

KZN Aquatics Programme 2013/14;;;;
;;;;
May-13;;;;
26;Sun;Qualifying Gala All Levels;Kings Park;10H00
Jun-13;;;;
1;Sat;Sprint Gala ;Kings Park;13H00
9;Sun;Seals Winter Gala 1;Jolliffe (PMB);
22;Sat;Level 0 Gala 1;Kings Park;13H00
23;Sun;Seals Winter Gala 2;Jolliffe (PMB);
29;Sat;Age Group Gala 1;Kings Park;13H00
Jul-13;;;;
9 to 15;Tues;Seals Prestige Gala;Kings Park;08H00
20;Sat;Level 0 Gala 2;Kings Park;13H00
21;Sun;SWIMBOARD AGM;Kings Park;10H00
27;Sat;Age Group Gala 2;Kings Park;13h00
Aug-13;;;;
10;Sat;Westville Jnr TYR Sprints;Kings Park;08H00
17;Sat;Age Group Gala 3;Kings Park;13H00
23 To 25;Fri;Beavers Gals;Kings Park;07H00
31;Sat;Level 0 Gala 3;Kings Park;13h00
Sep-13;;;;
7;Sat;KZN Jnr Champs;Kings Park;07H00
14;Sat;Age Group Gala 4;Kings Park;13H00
21 to 23;Sat;Seagulls Short Course;Kings Park;07H00
28;Sat;Level 0 Gala 4;Kings Park;13H00-
Oct-13;;;;
12;Sat;Age Group Gala 5;Kings Park;13H00
13;Sun;Level 0 Gala 5;Arena Park;10H00
18 to 20;Fri;Action Swim Champs;Kings Park;07H00
Nov-13;;;;
3;Sun;Lake Eland Mile;Margate;TBA
9;Sat;Age Group Gala 6;Kings Park;13H00
10;Sun;Level 0 Gala 6;Stanmore;10H00
15 To 17;Fri;Westville TYR Sprints;Kings Park;07H00
23 To 24;Sat;Capital K ;Midmar;TBA
29;Fri;KZN Relay Gala;Kings Park;18H00
Dec-13;;;;
8;Sun;Level 0 Gala 7;Umlaza B;10H00
10 to 14;Tues;KZN Champs Level 2 & 3;Kings Park;07H00
15;Sun;KZN OWS Champs;TBC;
Jan-14;;;;
12;Sun;Level 0 Gala 8;Firwood Rd;10H00
18;Sat;Age Group Gala 7;Kings Park;13H00
Feb-14;;;;
1;Sat;Age Group Gala 8;Kings Park;13H00
2;Sun;Level 0 Gala 9;Austerville;10H00
8 to 9;Sat;Midmar Mile;DTBC;TBC
15 to 16;Sat;KZN Level 1/0 Champs;Kings Park;07H00
22;Sat;Age Group Gala 9;Kings Park;13H00
23;Sun;Level 0 Gala 10;TBA;10H00
Mar-14;;;;
1;Sat;Age Group Gala 10;Kings Park;13H00

RoryGren
Junior Poster in Training
71 posts since Oct 2007
Reputation Points: 12
Solved Threads: 11
Skill Endorsements: 0

Thanks for replying, guys.
I added loop counters into the foreach loops and the $Cal one came out at 52 and $Calendar came out at 39, both correct!
The "debug" counters, print_r()'s and echo's I put into the foreach loops all display the information correctly!
Just the database entries that went haywire!

RoryGren
Junior Poster in Training
71 posts since Oct 2007
Reputation Points: 12
Solved Threads: 11
Skill Endorsements: 0
 
© 2013 DaniWeb® LLC
Page rendered in 0.3158 seconds using 2.78MB