last day (20 days later) » 

12:14 PM
0
A: Load data from database according to the number that i clicked

DelightedD0DTry this, changes explained in comments: <?php $username = $_SESSION["username"]; if(isset($_POST['idWork'])){ $id = $_POST['idWork']; $job_title = mysql_real_escape_string($_POST["job_title"]); $compan...

 
I get this error Notice: Undefined index: id in E:\xampp\htdocs\CVToolGismo\addCV.php on line 472 And this might be the reason that it doesn't work
 
What code is on that line in your file?
 
the code in linr 472 is this .... $id = $row['id']; ..... Also i replace the var fileName = 'thisFile.php?idWork='; with this .... var fileName = 'thisFile.php?idWork='; ... As you mentioned in the comment
 
Is that the one in the while loop or in the for loop?
 
Check this link , it is a print screen of the code prntscr.com/6fyt6e
Also if I click on a number the error disappear but it doesn't load the data to the form
I tried your code and I detect that when I click on any number the url on my browser become addCV.php?idWork=undefined , so I can understand that it does not get the id value because if I write the number by myself for example addCV.php?idWork=4 it loads the data
 
12:14 PM
What version of jQuery are you using?
 
Do not lough at me but how can i see that?
 
Right click on one of the links and select "inspect element" , does the data-row-id attribute have a value?
 
<script src="js/jquery-1.11.1.min.js"></script>
Is that the right version ????
 
Hmm, this should work see jsfiddle.net/DelightedDoD/kdzev1gv/1
Is your page viewable online?
 
no it is not online I am going to check it again and I will inform you :)
I found 2-3 bugs... 1) is that in the SELECT method --> SELECT job_title,company,website,start_date,end_date,start_year,end_year,work_history FROM work WHERE username='$username' order by id asc limit 1 ... if I make the limit 0 the error disappears but i believe that doesnt solve the problem and also when I click on a number the url become like this --> addCV.php?idWork=undefined and if I replace the undefined with a number for exampe addCV.php?idWork=7 then it loads me the data but it loads the data with id=6
 
12:14 PM
Right click on one of the links and select "inspect element" , does the data-row-id attribute have a value?
 
hi check the image prntscr.com/6g78a8
 
gotta take the kids to school, but ill look at it again when I get back, your page isnt viewable online is it? That would be helpful
 
No it is not because it is a project for a module of my college but i can send you the file if you want
Here is the link of my google drive that I made a public file for you in order to download this file IF you want ... drive.google.com/file/d/0B7S5bM5pZmRCazljNUI1Umt4QU0/…
 
1:12 PM
Im not sure if this is it, but you are loading jquery twice, here <script src="js/jquery-1.11.1.min.js"></script> and here <script type="text/javascript" src="https://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js"></script>
Yep, that's it
 
yy that was the problem but now why does it load the data with id 2 when i click on 3
 
Get rid of the <script type="text/javascript" src="https://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js"></script>
Looking into that, in the mean time, you should put all of your jQuery code into one onLoad function like this:
<script type="text/javascript">
$(document).ready(function () {
$("#updateSkill").click(function () {
$("#idS").css("display", "none");
var r = parseInt($("#idS").val(), 10) + 1;
$("#idS").val(r);
});
$("#updateWork").click(function () {
$("#idW").css("display", "none");
var r = parseInt($("#idW").val(), 10) + 1;
$("#idW").val(r);
});

// listen for clicks on the id links
$('[data-row-id]').click(function (e) {
e.preventDefault();
var fileName = 'addCV.php?idWork='; //change "thisFile.php" to the name of this file in your project, the "?" starts the GET parameters, idWork= sets the key for
 
so you suggest me to place this code in the beginning of the head tags and what should i delete?
 
Hold on, Ill post the whole file
 
Thanks :)
 
1:31 PM
You're welcome, I edited the shared file, give that a try, lemee know what it does
 
I will try it right now
Notice: Undefined index: id in E:\xampp\htdocs\CVToolGismo\addCV.php on line 494
Additionally, i want for the clicked number for example 4 to update the data for the id=4 when i click on update button
I want to thank you again for your help because without you we might have big troubles
 
2:10 PM
No problem, try the updated shared file
Just made another change
try it now
 
ok
Did you upload it on the drive?
 
Again it shows me undefined index id on 512 ... prntscr.com/6g8fuo
 
2:48 PM
THe error is saying that the row array that is returned from the query doesnt have a key named "id" are there no records for the current user?
 
Notice: Undefined index: id in E:\xampp\htdocs\CVToolGismo\addCV.php on line 512

That what it says
 
See that's whats weird, if there were no results, the while loop shouldnt even run
 
But we have a result right ? I mean we have data in the database
This error happens because we want to update the clicked data or not?
If you have installed XAMPP in your computer I can share with you the whole site
 
This line should get the first record for the current user and set $id to the id for that record, but something strange is happening, its like its finding that first record but say that it has no key named id
Wait a sec, ....try the updated file
It should work now
 
yes it work now
But now we want to update the data with the clicked number for example the clicked number is 4 then we should update the data with id=4
If we can do that after that you can give us instructions what changes we should make in order to make it work the same for the education, skills and text
 
3:02 PM
What happens when you click on the number now?
 
it shows me the data of the work history according to this number(id)
it works fine
Now we want to update the selected data
and then we want to do the same for the education , skills and text.
I will upload the code again with some changes
 
Gotta get some sleep, ill look at it again tonight
:)
 
thank you so much this the update file ... I dont know how to thank you :D
 

  last day (20 days later) »